Adding user defined range in macro
Sub Clear_Empty_Columns()
' Clear_Empty_Columns Macro
' Macro recorded 5/19/2009 by Jacky Del Hoyo
'
Dim varRange As Range
Set varRange = Application.InputBox("Select range", Type:=8)
For Each cell In varRange.Cells
If (cell) = 0 Then
cell.Columns.EntireColumn.Hidden = True
Else
cell.Columns.EntireColumn.Hidden = False
End If
Next cell
End Sub
--
If this post helps click Yes
---------------
Jacob Skaria
"Jacky D." wrote:
I'd like to know if I can add an inputbox to the following macro so I can
define what row to test the If statement against. Right now, I am going into
the macro and changing the range (ie from "A31:CL31" to "A50:CL50"), but
that's un ugly solution. I am not a programmer, and am usually pretty good at
finding code and modifying to suit my needs, but this is a bit beyond my
scope.
Macro to hide rows if column is zero:
Sub Clear_Empty_Columns()
'
' Clear_Empty_Columns Macro
' Macro recorded 5/19/2009 by Jacky Del Hoyo
'
'
For Each cell In Range("A31:CL31").Cells
If (cell) = 0 Then
cell.Columns.EntireColumn.Hidden = True
Else
cell.Columns.EntireColumn.Hidden = False
End If
Next cell
End Sub
Thanks,
|