Scroll a FreezePanes back to most left column regardless of where Freezepanes starts (1 Viewer)

Rx_

Nothing In Moderation
Local time
Today, 13:03
Joined
Oct 22, 2009
Messages
2,803
Just had to share this, spent way more time than expected for a simple solution. Started a question, then found the answer mid way.

Access code automating Excel where ObjXL is an object that is set to Excel.Application

The Excel workbook has FreezePanes on column F other sheets might be G or H...
The code ends highlighting cell AZ6 so the scroll for the FreezePane is way at the wrong end.
Just want to scroll the Freeze Payne back to the left most side no matter what column it is set to.

ObjXL.ActiveWindow.ScrollColumn = 1 ' data ends up at left column, scroll freezepayne back to the left no matter what column the freezepayne starts.

Range("E5").Select
Range("B5").End(xlToRight).Select
' single cell last populated cell on Row 5 selected

Range("B4", Range("B4").End(xlToRight)).Select
' selects B4 then selects B4 and all cells to end of row 4
Selection.Font.Bold = True ' bolds the highlighted cells
 
Last edited:

Users who are viewing this thread

Top Bottom