Should do it
Sub hidecolumnsinrow()
mycell = InputBox("Enter starting cell ie: a20")
mr = Range(mycell).Row
mc = Range(mycell).Column
lc = Cells(mr, Columns.Count).End(xlToLeft).Column
For i = mc To lc
If Cells(mr, i) = 0 Then Columns(i).Hidden = True
Next i
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(E-Mail Removed)
"Jacky D." <(E-Mail Removed)> wrote in message
news:C54DDF62-887D-4A7B-9744-(E-Mail Removed)...
> 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,