Reputation: 3
I need to change this by a YES/NO messagebox.
Yes:
For i = 90 To UBound(arrTemp) - 189 'WindowsXP
No:
For i = 510 To UBound(arrTemp) - 870 'Windows10
My script:
Dim i
Dim result
result = MsgBox("[YES] Windows10" & vbCrLf & vbCrLf & "[NO] WindowsXP", _
vbYesNo Or vbQuestion, "Select your Windows OS:")
If result = vbYes Then
i = "90"
Else
i = "510"
End If
How do I change both variables for YES and NO?
Upvotes: 0
Views: 1112
Reputation: 50119
I think you are close. You just need a couple more variables, besides i
, since that is the one you are using in your for loop:
Dim i
Dim minI
Dim difference
Dim result
'prompt user for OS
result = MsgBox("[YES] Windows10" & VbCrLf & VbCrLf & "[NO] WindowsXP", _
vbyesno or vbquestion, "Select your Windows OS:")
'change some variables depending on user answer
If result = vbyes Then
minI=90
difference = 189
Else
minI=510
difference = 870
End If
'Do your loop based on variables.
For i = minI to UBound(arrTemp) - difference
Next i
The only other thing is to not set you numeric variables with quotes around them.
Upvotes: 2