Trying to enter code that will verify that a cell is within the correct range prior to running the rest of the macro. I've tried several ways that give errors. Suggestions appreciated. Thanks
Code:
Private Sub CommandButton3_Click()
Dim rng As Range
Set rng = ActiveCell
[COLOR=#ff0000]' Need code to verify that the active cell is within the named range. If not, MsgBox to click within range and then exit sub. If in range, then do the following:[/COLOR]
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=Range("K3") & "Punch List " & rng.Value & " (" & Format(Date, "m.d.yy") & ")"
End Sub