Autoselect data using Macros
Shoaib: Here is how to find the last row of data in a column and set that as
a range:
Dim Lrow As Long
Dim rng as Range
Lrow = Cells(Rows.Count, "A").End(xlUp).Row '"A" can be any column
Set Rng = Range("A2:A" & Lrow) 'starts at row 2 to allow for header
From here you can merge a recorded macro of creating your chart.
Mike F
wrote in message
oups.com...
Hi,
Here is what I am trying to achieve in Excel.
Have sheet where the user will enter data. The range of data can be
variable each time. between 4-8 rows and two columns (A and B).
I want to write a macro that will do the following:
1. Find the first blank row in column A and now it has the range of
valid data.
2. Use the range from Step 1 to create an XY chart where data in Col A
is X Axis and Col B is y-axis.
3. Label the chart and place it on the same sheet as data.
Please let me know how to handle dynamic/variable range selection in
Excel Macros.
Thanks,
Shoaib
|