Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Why Loop only happens once? Baffles Me...

I did make that change to the If statemant.

No Luck. It seems that the loop stops after one iteration when it is
running automatically (F-5, or run from the Excel Worksheet, but if I run it
say manually (f-8) the loop happens just as it is supposed to many times
without stopping.

Rog



"libby" wrote in message
...
Hi

I'm not sure exactly what you're trying to do with your
code, but I think your problem may be to do with your If
statement.

it should be

If not c is nothing
'then the code for what you want to happen if does find c
else
'what happens if it doesn't find c
end if

-----Original Message-----
I have a macro I have written as follows that will only

loop once once when
run via Excel spreadsheet (ctrl-Shift-r). But if I step

through the code
the loop will work just fine and run as many times as

needed (423 in this
case)

What am I missing here?


i = 3
Do While i < 423 iSearch = Range("D" & i).Value
With Worksheets("Eff&PerData").Range("D1:D" &

iEffRows)
Set c = .Find(iSearch, LookIn:=xlValues)
End With
If c Is Nothing Then
Worksheets("EFF_Place_Holders").Select
Range("A" & i & ":J" & i).Select
Selection.Copy
Worksheets("Eff&PerData").Select
Range("A" & iEffRows).Select
ActiveSheet.Paste
iEffRows = iEffRows + 1
'Not Found
Else
Debug.Print ""
'Found
End If
i = i + 1
Loop
End Sub


.



Reply
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
Find loop doesn't loop JSnow Excel Discussion (Misc queries) 2 June 24th 09 08:28 PM
For... Next Loop mike_vr Excel Discussion (Misc queries) 2 January 17th 08 10:40 AM
getting out of a if loop rk0909 Excel Discussion (Misc queries) 3 April 11th 06 03:55 PM
Worksheet_Change - loop within a loop bgm Excel Programming 1 January 19th 04 01:27 PM
HELP!!!! Can't stop a loop (NOT an infinite loop) TBA[_2_] Excel Programming 3 December 14th 03 03:33 PM


All times are GMT +1. The time now is 02:26 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"