Userform for specific columns

Viewed 29

Hello I am relatively new to VBA,

And I was able to create a Datepicker following a tutorial. The only thing I am struggling with, is that I want the userform to open automatically if a cell in the columns F;H;I is being clicked. In the tutorial I created a little icon to open the userform. This doesn’t seem very natural to me.

I hope someone can help me out Cheers yours Henrique

1 Answers

You need to write an event procedure. Something like this:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Not (Intersect(Target, Range("F:G,I:I")) Is Nothing) Then
        YourUserForm.Show
    End If
End Sub
Related