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
http://www.angelfire.com/biz7/julian...ans_macros.htm