Only run a option button macro if a cell >0

Closed
ddt - Mar 17, 2010 at 11:35 AM
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 - Mar 17, 2010 at 11:40 AM
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
Related:

1 response

rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
Mar 17, 2010 at 11:40 AM
well you can add some thing like

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