Moving the Active cell to the left of the screen

  • Thread starter Thread starter Dave Bash
  • Start date Start date
D

Dave Bash

I am trying to move the active cell so that its column is displayed as
the leftmost column on my screen.

I have two sheets - one with a Titles across the top row and the
second with a list of those titles. I want to be able to double click
on the second sheet item, have it match the column on the first. This
part works fine. The issue is how to have the chosen title display in
the left most column of my screen.

Thanks.

My code:
________________________________________________________________________________
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel
As Boolean)
If Target.Column = 2 And Target.Value <> "" Then jumpToHist
Target.Value
End Sub

Sub jumpToHist(tgt As String)
On Error Resume Next
col = Application.Match(tgt, Worksheets("Hist
(2)").Range("Print_Titles"), 0)

With Sheets("Hist (2)")
.Activate
.Cells(1, col).Activate
End With
On Error GoTo 0

End Sub
 
All you need is this:

Application.Goto Sheets("Hist (2)").Cells(col, 5), True

instead of this:

With Sheets("Hist (2)")
.Activate
.Cells(1, col).Activate
End With
 
Back
Top