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

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
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,215,302
Messages
6,124,148
Members
449,146
Latest member
el_gazar

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