View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Charles Chickering Charles Chickering is offline
external usenet poster
 
Posts: 272
Default Macro to move a cell to centre screen

Try this:
Sub GotoSpecifiedCell()
'Assumes Range "A1" holds the row number &
'Range "A2" holds the column number
Application.Goto Reference:=Cells(Range("A1").value, Range("A2").value), _
Scroll:=True
With ActiveWindow
.SmallScroll Up:=(.VisibleRange.Rows.Count / 2), _
ToLeft:=(.VisibleRange.Columns.Count / 2)
End With
End Sub

--
Charles Chickering

"A good example is twice the value of good advice."


"Victor Delta" wrote:

I want to write a simple macro that will make a given cell (defined by the
contents of two other cells - i.e. row number and column number) move to
the centre of the screen (approximately).

Is there a simple way in which I can do this please? I can't find a function
to do it.

Thanks,

V