ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   how to trigger a validation change (https://www.excelbanter.com/excel-programming/432962-how-trigger-validation-change.html)

thomas donino

how to trigger a validation change
 
I have a macro which works properly and changes the drop down list based on
what is a certain cell (H3)
The drop down list is for cell (C5).
The problems I have are;
1. Where does the code belong? a module, on the worksheet? if so under
worksheet or declarations
2. I only want this to run when some one selects cell C5 so that the proper
dropdown box is there

Ty in advance

Kevin Smith[_2_]

how to trigger a validation change
 
Put the code in the Sheet Module and then use the Worksheet SelectionChange
option i.e

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If ActiveCell.Address = "$C$5" Then
'Run your code
End if

End Sub
--
Kevin Smith :o)


"thomas donino" wrote:

I have a macro which works properly and changes the drop down list based on
what is a certain cell (H3)
The drop down list is for cell (C5).
The problems I have are;
1. Where does the code belong? a module, on the worksheet? if so under
worksheet or declarations
2. I only want this to run when some one selects cell C5 so that the proper
dropdown box is there

Ty in advance


thomas donino

how to trigger a validation change
 
I read up on it on Chip Pearson's site and I put the code in as
Worksheet Change event rather than selection change and its working fine.
Is your way better?

"Kevin Smith" wrote:

Put the code in the Sheet Module and then use the Worksheet SelectionChange
option i.e

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If ActiveCell.Address = "$C$5" Then
'Run your code
End if

End Sub
--
Kevin Smith :o)


"thomas donino" wrote:

I have a macro which works properly and changes the drop down list based on
what is a certain cell (H3)
The drop down list is for cell (C5).
The problems I have are;
1. Where does the code belong? a module, on the worksheet? if so under
worksheet or declarations
2. I only want this to run when some one selects cell C5 so that the proper
dropdown box is there

Ty in advance


Kevin Smith[_2_]

how to trigger a validation change
 
It all depends when you want the event to be triggered before or after the
cell has been edited.
The Selection Change event runs every time that you select a new cell or a
new range (so this will run your code before you edit the cell) and the
Change event runs every time that you edit a cell (so this will run after you
have edited the cell).

--
Kevin Smith :o)


"thomas donino" wrote:

I read up on it on Chip Pearson's site and I put the code in as
Worksheet Change event rather than selection change and its working fine.
Is your way better?

"Kevin Smith" wrote:

Put the code in the Sheet Module and then use the Worksheet SelectionChange
option i.e

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If ActiveCell.Address = "$C$5" Then
'Run your code
End if

End Sub
--
Kevin Smith :o)


"thomas donino" wrote:

I have a macro which works properly and changes the drop down list based on
what is a certain cell (H3)
The drop down list is for cell (C5).
The problems I have are;
1. Where does the code belong? a module, on the worksheet? if so under
worksheet or declarations
2. I only want this to run when some one selects cell C5 so that the proper
dropdown box is there

Ty in advance



All times are GMT +1. The time now is 08:16 AM.

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