P
PVANS
Good morning,
Please could someone help me with this. I currently have the following
piece of code in my workbook:
Sub ProdCheck()
Dim Answer As String
If Range("B2").Value = "ESX" Then
Range("AB2").Value = 10
'*****this is where the ELSEIF argument of the code should be*****
Else: Answer = MsgBox(MyNote, vbQuestion + vbYesNo, "Does this product
exist?")
If Answer = vbNo Then
MsgBox "You pressed NO!"
Range("AB2").Value = 0
Else
MsgBox "You pressed Yes!"
Range("AB2").Value = 1000
End If
End If
End Sub
Whilst the code works, it has two issues with regards to what I am trying to
achieve:
1.) I need it to loop through the whole worksheet performing the if
statement. ie: not just row 2, but row 2-last row on worksheet
2.) in the IF statement itself, I need to include an ELSE IF (see commented
secion in code), and for the code to check whether the value in the cell "B"
it is checking is in ColumnA of worksheet2, and if so for "AB2" = 100, if not
- then continue to the ELSE part of the current code
Please can someone help with this, I am completely stuck
Really appreciate it
Regards,
Please could someone help me with this. I currently have the following
piece of code in my workbook:
Sub ProdCheck()
Dim Answer As String
If Range("B2").Value = "ESX" Then
Range("AB2").Value = 10
'*****this is where the ELSEIF argument of the code should be*****
Else: Answer = MsgBox(MyNote, vbQuestion + vbYesNo, "Does this product
exist?")
If Answer = vbNo Then
MsgBox "You pressed NO!"
Range("AB2").Value = 0
Else
MsgBox "You pressed Yes!"
Range("AB2").Value = 1000
End If
End If
End Sub
Whilst the code works, it has two issues with regards to what I am trying to
achieve:
1.) I need it to loop through the whole worksheet performing the if
statement. ie: not just row 2, but row 2-last row on worksheet
2.) in the IF statement itself, I need to include an ELSE IF (see commented
secion in code), and for the code to check whether the value in the cell "B"
it is checking is in ColumnA of worksheet2, and if so for "AB2" = 100, if not
- then continue to the ELSE part of the current code
Please can someone help with this, I am completely stuck
Really appreciate it
Regards,