Only run a option button macro if a cell >0

Closed
-
Posts
4476
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
August 2, 2020
-
Can anyone help with adding a limitation to a macro?
I currently have a very simple option button activating another worksheet in the workbook. But I would
like to add a specification to it so that it only activates the next worksheet if the user has completed a cell ajacent to the button.
Any help would be greatly appreciated!
This is what I have so far:
Public rTarget As Range
Sub OptionButton10_Click()
Set rTarget = Target
If Target.Cells(F28).Value = ">0" Then
ActiveWorkbook.Sheets("Reagent Rental LBL").Activate

Else
MsgBox "Please complete annual test volume"
End If

End Sub

1 reply

Posts
4476
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
August 2, 2020
768
well you can add some thing like

If(length(trim(Range("A1").value)) > 0 then
'activate work book