simple VBA code to reset last cell???

MikeJP

Board Regular
Joined
Mar 10, 2003
Messages
51
Hello All,

I to reset the last cell in a worksheet after clearing all of the information in it via VBA , with out deleting and recreating the worksheet. ie last cell should be A1.

Thanks

Mike Piles
 

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
i Know its very late for a reply.
bu i had the same problem and i found/modified this code.

Code:
Sub ResetLastCell ()
Dim x as Long
Dim y as Long
x = ActiveSheet.UsedRange.Rows.Count
y = ActiveSheet.UsedRange.Columns.Count
End Sub

i cant say i know how it works.
But it resets the last used cell without needing to save.

-Bromy
 
Upvote 0
Juan Pablo above has it right; any reference to usedrange seems to do it. Handy if you've deleted thousands of rows. If you're in the worksheet you can put "? activesheet.usedrange.address" (without quotes) in the immediate window.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,333
Members
452,636
Latest member
laura12345

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