Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default How to pop up a Macro when the cell in one column is selected-urge

I know how to call a Macro when one cell is selected as below. But this only
works when cell B1 is selected.

But anybody knows how to trigger the macro when any cell in one column is
selected (E.g when cell from B1 to B1000 is selected...) Thanks a lot!

+++++++++++++++++++++++++++++++++++++++++++++
Private Sub Worksheet_Selectionchange(ByVal Target As Range)

If Target.Address = "$B$1" Then
Call OpenCalendar
End If
End Sub
+++++++++++++++++++++++++++++++++++++++++++++


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default How to pop up a Macro when the cell in one column is selected-urge

if target.cells.count 1 then exit sub 'only one cell at a time
if intersect(target, me.range("b1:B1000")) is nothing then
exit sub
end if

is one way.

Turboj wrote:

I know how to call a Macro when one cell is selected as below. But this only
works when cell B1 is selected.

But anybody knows how to trigger the macro when any cell in one column is
selected (E.g when cell from B1 to B1000 is selected...) Thanks a lot!

+++++++++++++++++++++++++++++++++++++++++++++
Private Sub Worksheet_Selectionchange(ByVal Target As Range)

If Target.Address = "$B$1" Then
Call OpenCalendar
End If
End Sub
+++++++++++++++++++++++++++++++++++++++++++++


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default How to pop up a Macro when the cell in one column is selected-

Thanks Dave. The problem is well solved. The final codes are as below.

+++++++++++++++++++++++++++++++++++++++++++
Private Sub Worksheet_Selectionchange(ByVal Target As Range)

If Target.Cells.Count 1 Then Exit Sub 'only one cell at a time

If Intersect(Target, Me.Range("G2:I5000,K2:K5000")) Is Nothing Then
'column G to I & K needs data input

Exit Sub
End If

Call OpenCalendar ' Call the macro to input date by using Calendar

End Sub
+++++++++++++++++++++++++++++++++++++++++++



"Dave Peterson" wrote:

if target.cells.count 1 then exit sub 'only one cell at a time
if intersect(target, me.range("b1:B1000")) is nothing then
exit sub
end if

is one way.

Turboj wrote:

I know how to call a Macro when one cell is selected as below. But this only
works when cell B1 is selected.

But anybody knows how to trigger the macro when any cell in one column is
selected (E.g when cell from B1 to B1000 is selected...) Thanks a lot!

+++++++++++++++++++++++++++++++++++++++++++++
Private Sub Worksheet_Selectionchange(ByVal Target As Range)

If Target.Address = "$B$1" Then
Call OpenCalendar
End If
End Sub
+++++++++++++++++++++++++++++++++++++++++++++


--

Dave Peterson

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How I can change the direction of Paste All in MS-Excel (MOST URGE Harry New Users to Excel 1 August 24th 07 05:38 PM
Macro, Copy Selected Cells Down a Column DB33 Excel Discussion (Misc queries) 9 February 15th 06 09:29 PM
Macro to take selected cells times a selected cell Craig Excel Programming 4 October 24th 05 12:54 AM
How to record macro to work on selected column/row? Olezhka Excel Programming 1 March 5th 04 07:30 PM
Macro to move selected cell contents to a specific column on same row Ben Johnson[_3_] Excel Programming 1 February 10th 04 08:43 PM


All times are GMT +1. The time now is 12:24 AM.

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

About Us

"It's about Microsoft Excel"