ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to make a selected row visible in the Window? (https://www.excelbanter.com/excel-programming/404985-re-how-make-selected-row-visible-window.html)

Raj[_2_]

How to make a selected row visible in the Window?
 
On Jan 24, 6:36*pm, Raj wrote:
On Jan 24, 4:50*pm, Raj wrote:

Hi,


I have a worksheet and a Userform. The userform has a commandbutton to
which the following code is attached:
Cells(Selection.Row, 11).Offset(1, 0).Select
The idea is to select the the cell in Column 11 in the next row below.
This happens successfully. However, the row having the selected cell
is not automatically visible (vertically scrolled into )in the window.
How can I get this done?


Thanks in advance for the help.


Regards,
Raj


Hi,

I could solve the problem with the following code:
ActiveWindow.ScrollRow = Selection.Row

As it was an autofilter, I also preceded the following code to go to
the next visible row:
Do While ActiveCell.EntireRow.Hidden = True
ActiveCell.Offset(1, 0).Select
Loop
The complete code for the next button now is:
Cells(Selection.Row, 11).Offset(1, 0).Select
Do While ActiveCell.EntireRow.Hidden = True
ActiveCell.Offset(1, 0).Select
Loop
ActiveWindow.ScrollRow = Selection.Row

If there is a better way of doing this, I shall be glad to learn.

Thanks,
Raj


The useful code for selecting the next visible row in an autofiltered
list was downloaded from: http://www.angelfire.com/biz7/julian...ans_macros.htm

Raj



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

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