LAST ROW = not really last row

Hlatigo

Well-known Member
Joined
Jun 3, 2002
Messages
677
I have the following piece of code and it works great until i finished the project and realized that I have other tables that should not be altered by the below code. I love the code (got it frm here) and so i would just like to add something to it so it starts some place other then the very bottom of the spreadsheet.

is there a way to start the lastrow on row 15000 or something and go up from there? maybe after the word row do something like row + 40,000 so i start near row 20,000?

Code:
lastrow = ActiveSheet.UsedRange.Row + ActiveSheet.UsedRange.Rows.Count - 1


    Range("D6:D" & lastrow & ",L6:L" & lastrow & ",U6:U" & lastrow & ",AD6:AD" & lastrow).NumberFormat = "general"


thanks!
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
so here goes the answer to my question :), i guess i should have tried b4 hand.

lastrow = ActiveSheet.UsedRange.Row + ActiveSheet.UsedRange.Rows.Count - 10000
 
Upvote 0

Forum statistics

Threads
1,215,731
Messages
6,126,537
Members
449,316
Latest member
sravya

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