Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 363
Default Move/Scroll Specific Cell(Row) into the centre of the Screen ?

I am having Application.ScreenUpdating=TRUE used so i can SEE the DATA
behind a Userform.
But i am currently Selecting a specific Cell in Column A and Offseting it to
Offset(25,0) to try to get it to Be in the Center of the Screen.

But it does not seen to work real well according to where the rows were LAST
positioned.
Is there a code to Position a Row/Cell in the Centre of the Screen.
I need the user to be able to SEE the values in Column C in relation to the
Value in Column A used as the Offset Cell.

Corey....


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,073
Default Move/Scroll Specific Cell(Row) into the centre of the Screen ?

Corey wrote:
I am having Application.ScreenUpdating=TRUE used so i can SEE the DATA
behind a Userform.
But i am currently Selecting a specific Cell in Column A and Offseting it to
Offset(25,0) to try to get it to Be in the Center of the Screen.

But it does not seen to work real well according to where the rows were LAST
positioned.
Is there a code to Position a Row/Cell in the Centre of the Screen.
I need the user to be able to SEE the values in Column C in relation to the
Value in Column A used as the Offset Cell.

Corey....



Hi Corey,

I control a cell's position by manipulating the active window's
scrollrow and scrollcolumn properties.

Try out this little bit of code, which might give some clues for
solving your problem...

Public Sub CentreActiveCell()
On Error Resume Next
With ActiveWindow
..ScrollRow = ActiveCell.Row - _
Int(.VisibleRange.Rows.Count / 2)
..ScrollColumn = ActiveCell.Column - _
Int((.VisibleRange.Columns.Count - 1) / 2)
End With
On Error GoTo 0
End Sub

If the window has A1 in the top left corner and the active cell is in
the top-left screen quandrant, then it is not possible to centre the
active cell so the code does nothing, hence the On Error Resume Next.
Also, under the same condition, if the active cell is in the
bottom-right screen quadrant then the code can only raise the active
cell to centre it, it can't move it sideways towards the centre. And,
of course, again with A1 in the top-left corner of the window, an
active cell in the top-right screen quadrant can only me moved sideways
towards the centre but not down.

Ken Johnson

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,073
Default Move/Scroll Specific Cell(Row) into the centre of the Screen ?

Hi Corey,

I'm still stuffing things up!

Also, under the same condition, if the active cell is in the
bottom-right screen quadrant then the code can only raise the active
cell to centre it, it can't move it sideways towards the centre.


Should have said...

Also, under the same condition, if the active cell is in the
bottom-LEFT screen quadrant then the code can only raise the active
cell to centre it, it can't move it sideways towards the centre.

Ken Johnson

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 363
Default Move/Scroll Specific Cell(Row) into the centre of the Screen ?

Absolutely PEFECT Ken.

Thank You


Corey....

"Ken Johnson" wrote in message
oups.com...
Corey wrote:
I am having Application.ScreenUpdating=TRUE used so i can SEE the DATA
behind a Userform.
But i am currently Selecting a specific Cell in Column A and Offseting it
to
Offset(25,0) to try to get it to Be in the Center of the Screen.

But it does not seen to work real well according to where the rows were
LAST
positioned.
Is there a code to Position a Row/Cell in the Centre of the Screen.
I need the user to be able to SEE the values in Column C in relation to
the
Value in Column A used as the Offset Cell.

Corey....



Hi Corey,

I control a cell's position by manipulating the active window's
scrollrow and scrollcolumn properties.

Try out this little bit of code, which might give some clues for
solving your problem...

Public Sub CentreActiveCell()
On Error Resume Next
With ActiveWindow
.ScrollRow = ActiveCell.Row - _
Int(.VisibleRange.Rows.Count / 2)
.ScrollColumn = ActiveCell.Column - _
Int((.VisibleRange.Columns.Count - 1) / 2)
End With
On Error GoTo 0
End Sub

If the window has A1 in the top left corner and the active cell is in
the top-left screen quandrant, then it is not possible to centre the
active cell so the code does nothing, hence the On Error Resume Next.
Also, under the same condition, if the active cell is in the
bottom-right screen quadrant then the code can only raise the active
cell to centre it, it can't move it sideways towards the centre. And,
of course, again with A1 in the top-left corner of the window, an
active cell in the top-right screen quadrant can only me moved sideways
towards the centre but not down.

Ken Johnson



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,073
Default Move/Scroll Specific Cell(Row) into the centre of the Screen ?


You're welcome Corey.
I'm glad to be of assistance to such an industrious VBA worker.

Ken Johnson

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to display the cell it goes to at the centre of the monitor screen? cyberdude Excel Discussion (Misc queries) 1 July 23rd 06 01:20 PM
How to display the cell it goes to at the centre of the monitor screen cyberdude Excel Programming 1 July 23rd 06 10:18 AM
Cursor keys move active cell or scroll screen, how do I select whi Rob Croft Excel Discussion (Misc queries) 1 June 18th 05 11:51 PM
how do i centre headings accross the screen in excell? Sethius Excel Discussion (Misc queries) 1 February 1st 05 10:46 AM
Move a row to the centre of my sheet Excel 2002 Paul Excel Programming 2 September 27th 04 12:46 AM


All times are GMT +1. The time now is 09:43 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"