BlueDolphin9
10-25-2019, 04:38 AM
Is it possible to define a range in VBA based on a value given in a cell?
For example, I have a dataset with a constantly changing number of rows. I have the number of rows in cell B2. Suppose cell B2 indicates the number of rows is 33, then I want the range to be D5: D33, but I want the selection of the last cell to be dependent on cell B2.
So if I change B2 to 50, the next time I run the macro, D5: D50 will be selected, but since I'm new to VBA I can't figure it out.
Thanks in advance for your help :)
For example, I have a dataset with a constantly changing number of rows. I have the number of rows in cell B2. Suppose cell B2 indicates the number of rows is 33, then I want the range to be D5: D33, but I want the selection of the last cell to be dependent on cell B2.
So if I change B2 to 50, the next time I run the macro, D5: D50 will be selected, but since I'm new to VBA I can't figure it out.
Thanks in advance for your help :)