Macro based on changing cell

elotromateo

New Member
Joined
May 19, 2010
Messages
42
Is there a way to have a macro start whenever a certain cell changes value?



Also, for cells with a list, is there a way to reference the options in the cell via a macro?
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Hi,
you can make a macro run if a spefic cell is changed:
http://www.ozgrid.com/VBA/run-macros-change.htm

your second question isn't quite clear.
the following will show you the contents of a data vaildation list:
sub whatever()
Dim strChoices As String
Dim choice

Range("E4").Select
strChoices = Selection.Validation.Formula1
MsgBox (strChoices)
end sub
 
Upvote 0
The first part helped a lot, but still is not quite perfect and I don't think it can really be done. The cell being changed is a list and I would like the macro to run once the cell has been changed from one value to another. As it currently is, once the value is changed, you need to go to another cell, and then return to the target cell, which I would like to avoid.



Sorry for not being clear about the second part. Is there a way to pull specific values from a list in a cell with a macro. So if the options are (A,B,C,D), then the macro will pull out option A (if so desired).
 
Upvote 0
Nevermind, I've decided to use a Combo Box and tie the macro to it so that will work there.

Also I figured out how to make an array, so the second problem has been solved as well.

Thanks for the help.
 
Upvote 0

Forum statistics

Threads
1,224,587
Messages
6,179,734
Members
452,939
Latest member
WCrawford

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top