Preventing selection of previous cell in Excel after changing tabs

Viewed 24

and thanks for the answers

I am designing a LogBook using excel VBA and this is the problem:

I work on Sheet2 and let's say I left the editing on cell F2 and go to Sheet1 to do other stuff. After I come back to Sheet 2 the selection remains on cell F2 but I don't want this. Actually, I don't want any cell to be selected. Since the selection of a cell marks the borders of that cell it does not look good on my design. I want to show A1 to Z40 without any cell selected. Hope I could describe it.

Any suggestiions?

1 Answers

Change Selection When Returning to Tab

  • Copy the following code to the Sheet2 code module.
Option Explicit

Private Sub Worksheet_Activate()

    ' You have to activate (select) something:
    Cells(Rows.Count, Columns.Count).Activate ' last cell on worksheet
    ' or e.g.:
    'Range("AA1").Activate

    With ActiveWindow
        .ScrollColumn = 1
        .ScrollRow = 1
    End With

End Sub
Related