Mightyginger
Programmer
A few questions about manipulating ranges.
1. Firstly if I have named a range and want to assign that range to a variable in a procedure in vba how do I do that? (I know this will be dead easy but can't seem to do it).
Say,
dim testrange as range
testrange=range("therangeishavealreadydefined"
it just gives me an error - how do I refer to to an already named range?
2. Imagine I have three columns of data. The first is a column with sequential dates (column A) and the other two columns have the prices for two different shares (so share1 in column B, share 2 in column C). The user then specifys dates between which they'd like to examine the difference between the two prices. At the moment I just loop through each row checking to see if the date is within the two dates specified and then take the difference of the cells. Is there a more efficient way to this this using ranges? I currenctly refer to each cell with the .cells notation using vairables
3. And just a quick one to finish. I want to assign some data to a range. If I know the column number it's in and row in which the data starts and the row when it ends can I assign a range to this set of data? And if so can I also name it using a variable?
Phew, thats all for now. many thanks in advance for any help you're able to provide.
Neil.
1. Firstly if I have named a range and want to assign that range to a variable in a procedure in vba how do I do that? (I know this will be dead easy but can't seem to do it).
Say,
dim testrange as range
testrange=range("therangeishavealreadydefined"
it just gives me an error - how do I refer to to an already named range?
2. Imagine I have three columns of data. The first is a column with sequential dates (column A) and the other two columns have the prices for two different shares (so share1 in column B, share 2 in column C). The user then specifys dates between which they'd like to examine the difference between the two prices. At the moment I just loop through each row checking to see if the date is within the two dates specified and then take the difference of the cells. Is there a more efficient way to this this using ranges? I currenctly refer to each cell with the .cells notation using vairables
3. And just a quick one to finish. I want to assign some data to a range. If I know the column number it's in and row in which the data starts and the row when it ends can I assign a range to this set of data? And if so can I also name it using a variable?
Phew, thats all for now. many thanks in advance for any help you're able to provide.
Neil.