Macro to move a cell to centre screen
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 |
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 |
Macro to move a cell to centre screen
Many thanks,
V "Charles Chickering" wrote in message ... 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 |
All times are GMT +1. The time now is 08:33 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com