LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default For Loop only executes with F8

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

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro code to remove a macro after it executes Charles Excel Programming 4 March 22nd 06 12:11 PM
Can I slow the rate that VB executes individual orders? MJM Excel Programming 1 October 12th 04 06:31 PM
SAveAs executes combobox code Alan Lyall Excel Programming 3 June 9th 04 12:52 AM
excel executes only a part of a macro mgr[_2_] Excel Programming 2 January 15th 04 07:18 AM
Count # of Times Sub Executes Mike[_32_] Excel Programming 1 July 15th 03 03:27 PM


All times are GMT +1. The time now is 06:49 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"