xlUp Problem

Matt

Board Regular
Joined
Feb 16, 2002
Messages
212
I'm having a little issue with the xlUp code. My macro downloads data from an As/400 system. I then add a chart selecting all data in column B as data source starting at B2 to the end of the data. The data in column B ends at B10, when I try the xlup command, it stops at B13 which is empty. I have tried adding code to the macro deleting all rows between B10 and B13, still the xlUp stops at B13. I don't know if anyone has any ideas but I'm at a dead loss.

Cheers

Matt
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Here's the relevant code that I'm using, the data ends at B10 but for some reason the last row is being set at B13. Hope someone can help.


Dim lastrow As Integer

lastrow = Range("b65536").End(xlUp).Row

Sheets("Sheet1").Select

Charts.Add
ActiveChart.ChartType = xl3DPieExploded
ActiveChart.SetSourceData Source:=Sheets("Sheet1").Range("B2:B" & lastrow), PlotBy:= _
xlColumns
 
Upvote 0
Forget that post, sorry for wasting time, the lastrow was being set whilst looking over a different sheet. Have now moved the sheet select statement before setting lastrow.

Apologies again
 
Upvote 0

Forum statistics

Threads
1,213,538
Messages
6,114,218
Members
448,554
Latest member
Gleisner2

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