Prevost
Board Regular
- Joined
- Jan 23, 2014
- Messages
- 198
Hi There,
I am trying to run a do while loop with two conditions but I can't get it to work properly. The user selects a wire gauge, and then the macro compares the selected cell value to a list of existing gauge values to determine whether or not any of the match up, hence the AWGCell(1 to 55) that is used to list all the wire gauges. I want the do while loop to continue until the gauge value equals one of the listed values OR until the counter exceeds 55. However, with this I cannot get it to work for some reason. Gauge and getgauge become equal to each other but then the loop just continues.
Thanks!
Dim x as integer
Dim getgauge, gauge, AWGCell(1 to 55) as double
[I list all the values of AWGCell(1 to 55)]
x=1
getgauge = Application.InputBox(Prompt:="Select Gauge", Type:=8)
gauge = AWGCell(x)
Do While gauge <> getgauge Or x < 56
gauge = AWGCell(x)
x = x + 1
Loop
End
I am trying to run a do while loop with two conditions but I can't get it to work properly. The user selects a wire gauge, and then the macro compares the selected cell value to a list of existing gauge values to determine whether or not any of the match up, hence the AWGCell(1 to 55) that is used to list all the wire gauges. I want the do while loop to continue until the gauge value equals one of the listed values OR until the counter exceeds 55. However, with this I cannot get it to work for some reason. Gauge and getgauge become equal to each other but then the loop just continues.
Thanks!
Dim x as integer
Dim getgauge, gauge, AWGCell(1 to 55) as double
[I list all the values of AWGCell(1 to 55)]
x=1
getgauge = Application.InputBox(Prompt:="Select Gauge", Type:=8)
gauge = AWGCell(x)
Do While gauge <> getgauge Or x < 56
gauge = AWGCell(x)
x = x + 1
Loop
End