PDA

View Full Version : Solved: VBA active cell



rabarber
09-25-2008, 08:52 AM
Hello
I need a code who will activate form, if i click on specific column

If sheetx.cell(x,x) = cliked then userform.show

my problem is that, i dont know how to define clicked cell, can somebody help?

Bob Phillips
09-25-2008, 08:55 AM
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Target.Address = "$H$5" Then '<=== adjust to suit

UserForm1.Show
End If
End Sub


This is worksheet event code, which means that it needs to be
placed in the appropriate worksheet code module, not a standard
code module. To do this, right-click on the sheet tab, select
the View Code option from the menu, and paste the code in.

rabarber
09-25-2008, 09:02 AM
thank you, works ideal form me :)

rabarber
09-25-2008, 09:28 AM
ok its not working so ideal i think.
can you tell me how to make it to work on entire cloumn?

If Target.Address = "A1:A12" like this its wont work :(

Bob Phillips
09-25-2008, 09:50 AM
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Target.Column = 1 Then '<=== adjust to suit

UserForm1.Show
End If
End Sub

rabarber
09-25-2008, 09:57 AM
thanks again :)