Forum Discussion
Excel
Aug 16, 2022Iron Contributor
Query related to VBA code..
Hello Everyone, I am trying to use For Each to get the range dynamically but getting a run time error . I am trying to get the Age row dynamically selected. is highlighted in yellow . ...
- Aug 25, 2022
Public Sub FunWithLogic() ' IF logic to determine age If ActiveCell.Value >= 90 Then MsgBox ActiveCell.Offset(0, -1).Value & " is 90 or older" ElseIf ActiveCell.Value >= 21 Then MsgBox ActiveCell.Offset(0, -1).Value & " is 21 or older" Else MsgBox ActiveCell.Offset(0, -1).Value & " is not allowed!" End If End Sub
Excel
Aug 25, 2022Iron Contributor
Hello Sir,
I have another question :
In FunWithLoops in that when 1 press the play or run button the MsgBox was created and i can see that step by step like that " User is 21 or older " ETC . So My question is instead of user i want to see the username like " Jenny is 21 or older " or "Harry Not Allowed! " or "Charlie is 90 or older"
etc
Please help
Here is a attached file
HansVogelaar
Aug 25, 2022MVP
Public Sub FunWithLogic()
' IF logic to determine age
If ActiveCell.Value >= 90 Then
MsgBox ActiveCell.Offset(0, -1).Value & " is 90 or older"
ElseIf ActiveCell.Value >= 21 Then
MsgBox ActiveCell.Offset(0, -1).Value & " is 21 or older"
Else
MsgBox ActiveCell.Offset(0, -1).Value & " is not allowed!"
End If
End Sub