I'm trying to make my code more generic. There's a range that I refer to multiple times within my code that I'd like to set as a variable. That way when this hard-coded range needs to be updated, I only have to make the change in one line of code (actually two - but it's the same concept for two different ranges) instead of several or many.
Here's what I'm playing with. I'd like to update the first two lines with the group of four lines commented below, but I can't quite get the syntax correct when those variables are called in the last two commented lines.
'-------Hard coded for now: Need to ID your color bar cells and Z-property cells--------------
Set rngColorBar = Range("E67", Range("E67").End(xlDown))
Set rngZprop = Range("D67", Range("D67").End(xlDown))
'-------preferably this would be written with variables, so you only have to change the Range at the top, not in several places. But, this isn't working yet.
'FirstColorBarCell = Range("E67") 'User updates this range reference manually, recompiles sub, and runs it.
'FirstZpropCell = Range("D67") 'User updates this range raference manually, recompiles sub, and runs it.
'Set rngColorBar = Range(FirstColorBarCell, Range(FirstColorBarCell).End(xlDown))
'Set rngZprop = Range(FirstZpropCell, Range(FirstZpropCell).End(xlDown))
Any ideas?
Thanks,
g
Bookmarks