how to trigger a validation change

T

thomas donino

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
 
K

Kevin Smith

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
 
T

thomas donino

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?
 
K

Kevin Smith

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).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top