» Restore the position in the window using VBA in Microsoft Excel
VBA macro tip contributed by Erlandsen Data Consulting offering Microsoft Excel Application development, template customization, support and training solutions
CATEGORY - General Topics in VBA
VERSION - All Microsoft Excel Versions
you can sometimes just activate the cell that was the active cell when the macro started. This is not always successful.
The following example code will restore the windowposition just like it was when the macro started :
Dim aRow As Long, aColumn As Integer, aRange As String ' global variables
Sub RememberWindowPosition() ' run this before making changes
With ActiveWindow
aRow = .ScrollRow
aColumn = .ScrollColumn
End With
aRange = Selection.Address
End Sub
Sub RestoreWindowPosition() ' run this to restore position in the window
Range(aRange).Select
With ActiveWindow
.ScrollRow = aRow
.ScrollColumn = aColumn
End With
End Sub
Book Store:
Recommended Books:
- Flipping Properties: Generate Instant Cash Profits in Real Estate
- F1 Get the Most out of Excel! The Ultimate Excel tip Help Guide
- Investing in Real Estate, Fourth Edition
- Lower Your Taxes - Big Time! : Wealth-Building, Tax Reduction Secrets from an IRS Insider
- Mortgages For Dummies®
- Learn MS Excel 2002 VBA/XML Programming
No comments have been submitted.

