Tigerexcel
Active Member
- Joined
- Mar 6, 2020
- Messages
- 493
- Office Version
- 365
- 2019
- Platform
- Windows
Once a range has been re-sized as a result of adding/deleting rows or columns the last cell should be res-set. As many know that may not happen until the workbook is saved and re-opened.
I had come across some VBA coding which I thought might be able to make this change without the need to close the workbook. I haven't got this to work properly, it still seems to retain the last cell.
Sub Refresh_used_range()
'Refresh UsedRange (get rid of "Ghost" cells)
Worksheets("Sheet1").UsedRange
'Select UsedRange
Worksheets("Sheet1").UsedRange.Select
End Sub
Is there more coding needed or does one still need to save and close the workbook?
I had come across some VBA coding which I thought might be able to make this change without the need to close the workbook. I haven't got this to work properly, it still seems to retain the last cell.
Sub Refresh_used_range()
'Refresh UsedRange (get rid of "Ghost" cells)
Worksheets("Sheet1").UsedRange
'Select UsedRange
Worksheets("Sheet1").UsedRange.Select
End Sub
Is there more coding needed or does one still need to save and close the workbook?