left align active column/cell in window

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi All,
does anyone know how I can set the column of the active cell to be leftmost
in the window?
When I activate a cell I need to see a specific range of columns starting
from the active one.
thank you,
 
Right click on the sheet tab and select view code.

in the dropdowns at the top of the resulting module select Worksheet in the
left dropdown and SelectionChange in the right dropdown (this is the default,
so they may already be selected).

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

End Sub

will be in the module. Place this code between the entries

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
ActiveWindow.ScrollColumn = Target(1).Column
End Sub
 
Hi NJS

You could try something like the code below should help you out

[AA1].Activate
ColNumber = ActiveCell.Column
ActiveWindow.ScrollColumn = ColNumber

S
 
Or to put the active cell in the top left corner

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.GoTo ActiveCell, True
End Sub

Mike
 
does anyone know how I can set the column of the active cell to be
leftmost
in the window?
When I activate a cell I need to see a specific range of columns starting
from the active one.

After you activate the cell, execute this...

ActiveWindow.ScrollColumn = ActiveCell.Column
ActiveWindow.ScrollRow = ActiveCell.Row

Rick
 
Excellent! thanks Tom (ScrollColumn was the property I was looking for)
cheers.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top