S
Sisilla
Hello All,
In my call to the following subroutine, the For Loop is supposed to
iterate 51 times. It does this fine when I run it with "step into," but
does not work when executed any other way.
Sub HideEmptyColumns(wks As Worksheet, lastcolumn As Long, firstrow As
Long)
'Hides all empty columns in the wks worksheet between columns 1 and
lastcolumn
'if the last non-empty row is firstrow
Dim col As Long
Dim LastRow As Long
ResetUsedRange wks
For col = 1 To lastcolumn
LastRow = (wks.Cells(Rows.Count, col).End(xlUp).row)
If LastRow = firstrow Then
Columns(col).Hidden = True
End If
Next col
End Sub
Might Excel not be giving the code enough time to execute? If so, how
do I give the bit of code more time? I appreciate any help.
Thanks,
Sisilla
In my call to the following subroutine, the For Loop is supposed to
iterate 51 times. It does this fine when I run it with "step into," but
does not work when executed any other way.
Sub HideEmptyColumns(wks As Worksheet, lastcolumn As Long, firstrow As
Long)
'Hides all empty columns in the wks worksheet between columns 1 and
lastcolumn
'if the last non-empty row is firstrow
Dim col As Long
Dim LastRow As Long
ResetUsedRange wks
For col = 1 To lastcolumn
LastRow = (wks.Cells(Rows.Count, col).End(xlUp).row)
If LastRow = firstrow Then
Columns(col).Hidden = True
End If
Next col
End Sub
Might Excel not be giving the code enough time to execute? If so, how
do I give the bit of code more time? I appreciate any help.
Thanks,
Sisilla