VBA Automatic Plotting Help

junglekingmowgli

New Member
Joined
Jan 21, 2011
Messages
2
Hi Everyone,

I am fairly new to VBA coding, and I needed some simple help. For my x-axis, I want to select time. For my Y-axis, I want to select temperature. This data is already provided to me.

I want to plot the data using scatter of line graph options. The problem arises because the data sets do not have equal number of rows. For example, 1 data set will have 200 rows and another 300. Thus, I need a VBA code that will select the data (last row) automatically and plot it.

All your help would be greatly appreciated.

Thank you!
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
if your using 2003 you can create a macro that records your actions to get the chart as you want it, then, the code can be tweaked to extend the range
 
Upvote 0
I should have been more clear. I am running 2007. I tried to record it, but it only selects the same data range every time. I need help in writing the commant to automatically select the last data row.

Thanks!
 
Upvote 0
This is useable, and configurable

Code:
Sub LastRowInOneColumn()
'Find the last used row in a Column: column A in this example
    Dim LastRow As Long
    With ActiveSheet
        LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
    End With
    MsgBox LastRow
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,246
Messages
6,170,999
Members
452,373
Latest member
TimReeks

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top