SelinaR
Board Regular
- Joined
- Feb 2, 2012
- Messages
- 65
- Office Version
- 2021
- Platform
- Windows
- Mobile
- Web
Morning
I use the below Macro for an annual leave tracker.... if it sees 0 it gives a pop up message, however it seems to have an issue that it sometimes give an error when the minimum number is 5 or 3 and on other rows if it's 0 (correctly)
I have tried tweaking it but have had no success - any suggestions?
Sub ANL()
Dim range
Dim nResult As Long
range = ActiveCell.Row
If (Cells(range, 3) <= 0) Then
nResult = MsgBox( _
Prompt:="Leave Unavailable. Do you still want to continue?", _
Buttons:=vbYesNo)
If nResult = vbNo Then
Exit Sub
Else
Selection.FormulaR1C1 = "ANL"
Selection.Font.ColorIndex = 0
Selection.Font.Name = "Arial Rounded MT Bold"
End If
Else
Selection.FormulaR1C1 = "ANL"
Selection.Font.ColorIndex = 0
Selection.Font.Name = "Arial Rounded MT Bold"
End If
End Sub
THANKS
I use the below Macro for an annual leave tracker.... if it sees 0 it gives a pop up message, however it seems to have an issue that it sometimes give an error when the minimum number is 5 or 3 and on other rows if it's 0 (correctly)
I have tried tweaking it but have had no success - any suggestions?
Sub ANL()
Dim range
Dim nResult As Long
range = ActiveCell.Row
If (Cells(range, 3) <= 0) Then
nResult = MsgBox( _
Prompt:="Leave Unavailable. Do you still want to continue?", _
Buttons:=vbYesNo)
If nResult = vbNo Then
Exit Sub
Else
Selection.FormulaR1C1 = "ANL"
Selection.Font.ColorIndex = 0
Selection.Font.Name = "Arial Rounded MT Bold"
End If
Else
Selection.FormulaR1C1 = "ANL"
Selection.Font.ColorIndex = 0
Selection.Font.Name = "Arial Rounded MT Bold"
End If
End Sub
THANKS