Dynamic Pivot Range - Still counting phantom data?

Mr Denove

Active Member
Joined
Jun 8, 2007
Messages
446
Morning,

So the xlLastCell in the following code is still counting the last row of data prior to being deleted (hence the dynamic range).

Code:
Set StartPoint = Data_sht.Range("A1")
  
  Set DataRange = Data_sht.Range(StartPoint, StartPoint.SpecialCells(xlLastCell))
  
  NewRange = Data_sht.Name & "!" & _
  DataRange.Address(ReferenceStyle:=xlR1C1)

I found that the LastRow still seems to work as expected

Code:
x = Data_sht.Cells(Rows.Count, "A").End(xlUp).Row
However I am at a loss how I force this into the dynamic range so it uses this and not the'phantom' range that existed prior to the data being deleted and resized.

I am using datasets in excess of 180,000 rows therefore I need to find a way to make it work and can then apply to other reports also.
As always thanks in advance.
Stuart
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Hi,
I dont know if this is your Problem but I had the same in Excel after deleting rows then save as csv, by the Import into an other Program they were always there as Errors.

But if after deletig the rows I made a save (normal xls or xlsx) and then as CSV they were gone

Just an Idea

Ray
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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