ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   HELP PLEASE Any one Know how (https://www.excelbanter.com/excel-programming/416992-help-please-any-one-know-how.html)

Wile Coyote

HELP PLEASE Any one Know how
 
Please, anyone can tell me how can i run macro by selecting a cell?

TIA

WC


Lars-Åke Aspelin[_2_]

HELP PLEASE Any one Know how
 
On Sat, 13 Sep 2008 05:01:55 GMT, Wile Coyote
wrote:

Please, anyone can tell me how can i run macro by selecting a cell?

TIA

WC


Try the following sub which you put into the worksheet where the cell
is:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not (Intersect(Target, Range("E5")) Is Nothing) Then
MsgBox "E5 was selected"
End If
End Sub

Hope this helps / Lars-Åke


franciz

HELP PLEASE Any one Know how
 
assuming you want to select row 4 and col 20, use this

Cells(4, 20).Select

regards, xlsops



"Wile Coyote" wrote:

Please, anyone can tell me how can i run macro by selecting a cell?

TIA

WC



Bob Phillips[_3_]

HELP PLEASE Any one Know how
 
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$H$1" Then

Call MyMacro
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.


--
__________________________________
HTH

Bob

"Wile Coyote" wrote in message
.60...
Please, anyone can tell me how can i run macro by selecting a cell?

TIA

WC




Wile Coyote

HELP PLEASE Any one Know how
 
"Bob Phillips" wrote in news:OVJBTHYFJHA.616
@TK2MSFTNGP06.phx.gbl:

Many Thanks

Is possible for address to be any cell in a column

TIA

WC


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$H$1" Then

Call MyMacro
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.




Don Guillett

HELP PLEASE Any one Know how
 
A bit of thought on your part would have yielded

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
' If Target.Address = "$H$1" Then
If Target.column = 6 Then

Call MyMacro
End If
End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Wile Coyote" wrote in message
2.60...
"Bob Phillips" wrote in news:OVJBTHYFJHA.616
@TK2MSFTNGP06.phx.gbl:

Many Thanks

Is possible for address to be any cell in a column

TIA

WC


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$H$1" Then

Call MyMacro
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.





Wile Coyote

HELP PLEASE Any one Know how
 
"Don Guillett" wrote in news:ewfVkMaFJHA.4460
@TK2MSFTNGP06.phx.gbl:
Thanks Don

i am at the point of knowing just enough to get an idea then getting
myself stuck in the middle of it.

i was thinking along the line of defining a range or that i had to define
"address" as a group of cells.

i am still struggling a bit with the hiearchy of the syntex.

i appreciate your help. It really is quite obvious, when one thinks in
the correct direction, as i clearly was not doing.

Thanks to all who replyed

WC


A bit of thought on your part would have yielded

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
' If Target.Address = "$H$1" Then
If Target.column = 6 Then

Call MyMacro
End If
End Sub




Bob Phillips[_3_]

HELP PLEASE Any one Know how
 
You can also use

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target., Me.Range("B:B")) Is Nothing Then

Call MyMacro
End If
End Sub

or


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target., Me.Range("B2:B20")) Is Nothing Then

Call MyMacro
End If
End Sub



--
__________________________________
HTH

Bob

"Wile Coyote" wrote in message
2.60...
"Don Guillett" wrote in news:ewfVkMaFJHA.4460
@TK2MSFTNGP06.phx.gbl:
Thanks Don

i am at the point of knowing just enough to get an idea then getting
myself stuck in the middle of it.

i was thinking along the line of defining a range or that i had to define
"address" as a group of cells.

i am still struggling a bit with the hiearchy of the syntex.

i appreciate your help. It really is quite obvious, when one thinks in
the correct direction, as i clearly was not doing.

Thanks to all who replyed

WC


A bit of thought on your part would have yielded

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
' If Target.Address = "$H$1" Then
If Target.column = 6 Then

Call MyMacro
End If
End Sub







All times are GMT +1. The time now is 05:44 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com