Using Excel VBA, how can I memorize and restore a worksheet to a precise set of visible rows and columns?
I have an excel macro that looks at the value of the current cell, computes a lot of stuff and runs around the whole workbook making changes, and then restores the cursor to the original cell. But the original cell ends up on the top row of the window, and that is annoying. I want the view of the sheet to remain the same, by somehow memorizing not only the original sheet and cell and .Selecting them afterward, but also by memorizing the exact set of visible rows and columns! How to?
This works:
Dim StartingSheet As String
Dim StartingCell As String
StartingCell = ActiveCell.Address
StartingSheet = ActiveSheet.Name
' do a lot of stuff
Worksheets(StartingSheet).Select
Range(StartingCell).Select
but by the end of the macro, the set of visible rows and columns shifts, which is bad.
I want to run the macro and NOT see any movement on the screen.