Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
I wonder if someone can help, I am trying to repeat some code 200 times can you tell me where I am going wrong in my loop. (It is doing 1024 times!) Sub test() Dim x As Integer Do Until x = 200 'code to repeat x = x + 1 Loop End Sub thanks for your help. Rob |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Rob,
Your code works for me. To test it, I changed: x = x + 1 to x = x + 1 Debug.Print x What final value do you get in the intermediate window if you add the debug line? --- Regards, Norman "Rob Hargreaves" wrote in message ... Hi I wonder if someone can help, I am trying to repeat some code 200 times can you tell me where I am going wrong in my loop. (It is doing 1024 times!) Sub test() Dim x As Integer Do Until x = 200 'code to repeat x = x + 1 Loop End Sub thanks for your help. Rob |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try it like this
Sub test() Dim x As Integer x = 0 Do Until x = 200 'code to repeat x = x + 1 Loop MsgBox x End Sub -- Regards Ron de Bruin http://www.rondebruin.nl "Rob Hargreaves" wrote in message ... Hi I wonder if someone can help, I am trying to repeat some code 200 times can you tell me where I am going wrong in my loop. (It is doing 1024 times!) Sub test() Dim x As Integer Do Until x = 200 'code to repeat x = x + 1 Loop End Sub thanks for your help. Rob |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi thanks for your responses guys.
I have tried to add the msgbox and it does display the correct number. The code i am using selects all then copies the selection and I was including this in my loop! Now moved it works as it should. Thanks again Rob "Rob Hargreaves" wrote in message ... Hi I wonder if someone can help, I am trying to repeat some code 200 times can you tell me where I am going wrong in my loop. (It is doing 1024 times!) Sub test() Dim x As Integer Do Until x = 200 'code to repeat x = x + 1 Loop End Sub thanks for your help. Rob |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
ADO & Loops: error in code? | Excel Programming | |||
Help on writing code more efficiently (Loops) | Excel Programming | |||
Code works but I have to run it 4 times | Excel Programming | |||
Help with text box limit (1024) | Excel Programming | |||
Over-Eager code is pasting 3 times | Excel Programming |