Phill Jones
New Member
- Joined
- Nov 2, 2013
- Messages
- 5
Hi all,
Long time reader - first time poster.
As the rather cryptic subject says, I'm trying to dynamically populate ranges to facilitate dynamic charts being generated.
I use excel 2010 at work, and 2011 for mac at home.
I have an example spreadsheet, but I don't know if I can upload it here. It makes far more sense than I can ever hope to make in using words, but I will do my best to put it in a nutshell:
Trouble is, I don't really understand this code. It doesn't appear to do anything when I make a worksheet change in "B2", but I don't know exactly what it is that I don't understand to ask for more specific help. I'm a bit stumped, and wish I could better articulate what help I need. I suspect that perhaps the fact that "B2" is validated from an indirect source might cause headaches?
Maybe there's a simpler way to achieve what I'm trying to do.
Thanks to anyone who can help (or understand what I'm attempting to do)
Phill
Long time reader - first time poster.
As the rather cryptic subject says, I'm trying to dynamically populate ranges to facilitate dynamic charts being generated.
I use excel 2010 at work, and 2011 for mac at home.
I have an example spreadsheet, but I don't know if I can upload it here. It makes far more sense than I can ever hope to make in using words, but I will do my best to put it in a nutshell:
I want any selection made in a dependent validation list which contains a list of named ranges to trigger a worksheet_change event which copies the range the selection points to and pastes it into a dynamic range in another column, beginning as a specified cell.I've tried using this, put together from some code examples from similar, but different issues.
Code:
<code style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; ">[COLOR=#00008B]Private[/COLOR] [COLOR=#00008B]Sub[/COLOR] Worksheet_Change([COLOR=#00008B]ByVal[/COLOR] Target [COLOR=#00008B]As[/COLOR] Range)
[COLOR=#00008B]If[/COLOR] [COLOR=#00008B]Not[/COLOR] Intersect(Target, [COLOR=#00008B]Me[/COLOR].Range([COLOR=#800000]"B2"[/COLOR])) [COLOR=#00008B]Is[/COLOR] [COLOR=#800000]Nothing[/COLOR] [COLOR=#00008B]Then[/COLOR]
Range(Range([COLOR=#800000]"B2"[/COLOR]).Value).Copy
Range([COLOR=#800000]"P2"[/COLOR]).Paste
[COLOR=#00008B] End[/COLOR] [COLOR=#00008B]If
[/COLOR][COLOR=#00008B]End[/COLOR] [COLOR=#00008B]Sub
[/COLOR]</code>
Trouble is, I don't really understand this code. It doesn't appear to do anything when I make a worksheet change in "B2", but I don't know exactly what it is that I don't understand to ask for more specific help. I'm a bit stumped, and wish I could better articulate what help I need. I suspect that perhaps the fact that "B2" is validated from an indirect source might cause headaches?
Maybe there's a simpler way to achieve what I'm trying to do.
Thanks to anyone who can help (or understand what I'm attempting to do)
Phill