Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Please, anyone can tell me how can i run macro by selecting a cell?
TIA WC |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
"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. |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
"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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|