ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Cell Position (https://www.excelbanter.com/excel-programming/313737-cell-position.html)

Robert Christie[_3_]

Cell Position
 
Hi
I run this line of code at the end of a procedure to activate first blank
cell in column B.

Cells(8, 2).End(xlDown).Offset(1, 0).Select

Depending where you are in the sheet the cell activated could be at the top
or bottom of the screen.
or
This line of code will always position active cell at top left and in my
situation €śhide€ť column A.
Application.Goto Reference:=Range(ActiveCell.Address), Scroll:=True

How can I have the active column B cell in the vertical centre of screen and
Column A still visible, when number of rows are passed the centre?

--
Thank you

Regards

Bob C

Bob Phillips[_6_]

Cell Position
 
Dim cRow As Long

cRow = Cells(8, 2).End(xlDown).Offset(1, 0).Row
Application.Goto Reference:=Range("A" & cRow), Scroll:=True
ActiveCell.Offset(0, 1).Select


--

HTH

RP

"Robert Christie" wrote in message
...
Hi
I run this line of code at the end of a procedure to activate first blank
cell in column B.

Cells(8, 2).End(xlDown).Offset(1, 0).Select

Depending where you are in the sheet the cell activated could be at the

top
or bottom of the screen.
or
This line of code will always position active cell at top left and in my
situation "hide" column A.
Application.Goto Reference:=Range(ActiveCell.Address), Scroll:=True

How can I have the active column B cell in the vertical centre of screen

and
Column A still visible, when number of rows are passed the centre?

--
Thank you

Regards

Bob C




Robert Christie[_3_]

Cell Position
 
Hi Bob

You code "unhide" column A but did not position active cell in centre of
screen.
I've modified your code to achieve this, but it will only work if number of
rows containing data is more than 25.
It's a bit messy jumping up and down the screen, plus you have to know in
advance the total number of rows appearing on screen.

cRow = Cells(8, 2).End(xlDown).Offset(-25, 0).Row
Application.Goto Reference:=Range("A" & cRow), Scroll:=True
ActiveCell.Offset(26, 1).Select

Thank you

Regards

Bob C.


"Bob Phillips" wrote:

Dim cRow As Long

cRow = Cells(8, 2).End(xlDown).Offset(1, 0).Row
Application.Goto Reference:=Range("A" & cRow), Scroll:=True
ActiveCell.Offset(0, 1).Select


--

HTH

RP

"Robert Christie" wrote in message
...
Hi
I run this line of code at the end of a procedure to activate first blank
cell in column B.

Cells(8, 2).End(xlDown).Offset(1, 0).Select

Depending where you are in the sheet the cell activated could be at the

top
or bottom of the screen.
or
This line of code will always position active cell at top left and in my
situation "hide" column A.
Application.Goto Reference:=Range(ActiveCell.Address), Scroll:=True

How can I have the active column B cell in the vertical centre of screen

and
Column A still visible, when number of rows are passed the centre?

--
Thank you

Regards

Bob C






All times are GMT +1. The time now is 05:05 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com