Hi,
It must be getting late or something but for some reason i am having trouble with a simple for-loop.
The for loop goes from 1 to 7.
When x=7 i want to display a message to screen.........but for some reason i never see the message.......here is the code.........what am i missing?
Sub test()
num_proj = 7
For x = 1 To num_proj
If x = num_proj Then MsgBox ("hlkjl")
If x = 1 Then MsgBox ("1")
If x = 2 Then MsgBox ("2")
If x = 3 Then MsgBox ("3")
If x = 4 Then MsgBox ("4")
If x = 5 Then MsgBox ("5")
If x = 6 Then MsgBox ("6")
If x = 7 Then MsgBox ("7")
If x = 1 Then
formula_string = "=Sum(C" & (22 * x + 8)
ElseIf x > 1 Then
formula_string = formula_string & " , C" & (22 * x + 8)
ElseIf x = num_proj Then
'formula_string = formula_string & " , C" & (22 * x + 8) & ")" & "lkjlkjl"
MsgBox ("in here")
End If
Next x
End Sub
Bookmarks