Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
How do I assign a macro to a cell so that when one clicks on it a Listbox
opens or a macro runs? Thanks |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
You could use the Worksheet_SelectionChange event. For example, assuming the cell to be D10 Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Target.Address="$D$10" then MsgBox Target.Address End If End Sub or using row and column numbers Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Target.Row = 10 And Target.Column = 4 Then MsgBox Target.Address End If End Sub In place of the MsgBox, you could enter code or call a macro. Hope that gets you started. Don "Ronbo" wrote in message ... How do I assign a macro to a cell so that when one clicks on it a Listbox opens or a macro runs? Thanks |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() "Don Lloyd" wrote: Hi, You could use the Worksheet_SelectionChange event. For example, assuming the cell to be D10 Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Target.Address="$D$10" then MsgBox Target.Address End If End Sub or using row and column numbers Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Target.Row = 10 And Target.Column = 4 Then MsgBox Target.Address End If End Sub In place of the MsgBox, you could enter code or call a macro. Hope that gets you started. Don "Ronbo" wrote in message ... How do I assign a macro to a cell so that when one clicks on it a Listbox opens or a macro runs? Thanks I want the click on the cell to call a ListBox. Where does the "Private Sub Worksheet" go?? In the UserForm/ListBox code, in the sheet or where?? Thanks for your help. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
For a list box you could use data validation.
Go to: Data Validation... Select list from the Allow: box In the Source: box select the range with the data you need for the user's selection. Hit OK *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() "Claud Balls" wrote: For a list box you could use data validation. Go to: Data Validation... Select list from the Allow: box In the Source: box select the range with the data you need for the user's selection. Hit OK *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! That is a cool function, but it can only ref one column. Second, is it possible to make it dynamic so that it changes with the list size? |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The Sub goes in the Worksheet Module
Right-click the sheet tab and select View Code. Select Worksheet in the left column and SelectioChange in the right column regards, Don "Ronbo" wrote in message ... "Don Lloyd" wrote: Hi, You could use the Worksheet_SelectionChange event. For example, assuming the cell to be D10 Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Target.Address="$D$10" then MsgBox Target.Address End If End Sub or using row and column numbers Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Target.Row = 10 And Target.Column = 4 Then MsgBox Target.Address End If End Sub In place of the MsgBox, you could enter code or call a macro. Hope that gets you started. Don "Ronbo" wrote in message ... How do I assign a macro to a cell so that when one clicks on it a Listbox opens or a macro runs? Thanks I want the click on the cell to call a ListBox. Where does the "Private Sub Worksheet" go?? In the UserForm/ListBox code, in the sheet or where?? Thanks for your help. |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() "Ronbo" wrote in message ... That is a cool function, but it can only ref one column. Second, is it possible to make it dynamic so that it changes with the list size? If we assume the list is in A1:An, use this formula with the DV list =OFFSET($A$1,,,COUNTA($A:$A)) |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
'IF' Macro to insert cell contents to alternate cell if cell not e | Excel Worksheet Functions | |||
using a cell value to control a counter inside a macro and displaying macro value | Excel Worksheet Functions | |||
macro to run a separate macro dependent on value in cell | Excel Programming | |||
Please help! Macro to change cell contents based on cell to the left | Excel Programming | |||
Question: Cell formula or macro to write result of one cell to another cell | Excel Programming |