ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   M S V B A Next X Excel 2003 (https://www.excelbanter.com/excel-discussion-misc-queries/135294-m-s-v-b-next-x-excel-2003-a.html)

Quandary 11 - 3 - 07[_2_]

M S V B A Next X Excel 2003
 
Range(Cells(30, 2), Cells(30, 2)).Select
Speed = Selection * 100000
For X = 1 To Speed: Next X

Macro stops at Next X While on Auto Selection, Even with a manual selection
It will always stop at next X.
Speed Selection is 400, Which Is about 1 loop / Sec
I'd Appreciate any Input, THANKS
How do I update The Date (18 - 3 - 07) In the Display name Below




Toppers

M S V B A Next X Excel 2003
 
No sure what your problem is but this works:

Sub a()
Range(Cells(30, 2), Cells(30, 2)).Select
Speed = Selection * 100000
For x = 1 To Speed: Next x
MsgBox x ' <===== 40000001
End Sub

"Quandary 11 - 3 - 07" wrote:

Range(Cells(30, 2), Cells(30, 2)).Select
Speed = Selection * 100000
For X = 1 To Speed: Next X

Macro stops at Next X While on Auto Selection, Even with a manual selection
It will always stop at next X.
Speed Selection is 400, Which Is about 1 loop / Sec
I'd Appreciate any Input, THANKS
How do I update The Date (18 - 3 - 07) In the Display name Below




JLatham

M S V B A Next X Excel 2003
 
Ok, so in cell B30 you have a value of 400
so Speed = Selection * 10000
gives Speed a value of 40000000
So your For...Next loop simply increments X 40000000 times and falls out.
I'm not sure what Auto Selection or manual selection has to do with anything
(actually, not sure what you're speaking of, to be truthful). Next X is the
last statement in your code and if you're following it in code step-by-step,
then that's where things end before exiting the routine?

As Toppers shows, if you add more code after that For...Next line, it gets
executed - or it should.

If you want to know how long that loop is actually taking, to the nearest
second, then try this
Sub timeIt()
Dim Speed as Long
Dim startTimerValue as Long
Dim X as Long

Speed= Range("B30") * 10000
startTimerValue = Timer
For X = 1 To Speed: Next X
Msgbox "Elapsed seconds: " & Timer - startTimerValue
End Sub

As for the date in your displayed name - click on the icon to the right of
the [Sign Out] button at the upper right of the web page (says "Edit my
Profile" if you hover over it) and change the entry in the Display Name
portion of your profile?



"Quandary 11 - 3 - 07" wrote:

Range(Cells(30, 2), Cells(30, 2)).Select
Speed = Selection * 100000
For X = 1 To Speed: Next X

Macro stops at Next X While on Auto Selection, Even with a manual selection
It will always stop at next X.
Speed Selection is 400, Which Is about 1 loop / Sec
I'd Appreciate any Input, THANKS
How do I update The Date (18 - 3 - 07) In the Display name Below





All times are GMT +1. The time now is 08:24 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com