Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / February 2007

Tip: Looking for answers? Try searching our database.

Macro to move a cell to centre screen

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Victor Delta - 21 Feb 2007 20:58 GMT
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
Charles Chickering - 21 Feb 2007 23:47 GMT
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
   
Signature

Charles Chickering

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

> 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
[quoted text clipped - 6 lines]
>
> V
Victor Delta - 25 Feb 2007 17:29 GMT
Many thanks,

V

> Try this:
> Sub GotoSpecifiedCell()
[quoted text clipped - 21 lines]
>>
>> V
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.