Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default HELP PLEASE Any one Know how

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

TIA

WC

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 913
Default 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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 79
Default 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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default 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



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default 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.





  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default 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



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default 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





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 10:39 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"