ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Select the next row up or down/ (https://www.excelbanter.com/excel-discussion-misc-queries/227162-select-next-row-up-down.html)

Bob

Select the next row up or down/
 

--
Bob

DILipandey

Select the next row up or down/
 
Hi Bob,

Try following:-
To select next up row:-
ActiveCell.Offset(-1, 0).EntireRow.Select
To Select next down rol:-
ActiveCell.Offset(1, 0).EntireRow.Select
Thanks.
--
Click on Yes, if it is useful.

Thanks & Best Regards,
Dilip Kumar Pandey
MBA, BCA, B.Com(Hons.)


New Delhi, India


"Bob" wrote:


--
Bob


Bob

Select the next row up or down/
 
Many thanks that works but I need it to select the data on that row from
sheet2 to several textboxes on a userform.
I have the following code so far. The data is found
on sheet2

Private Sub CommandButton4_Click()
Dim FoundCell As Range

ActiveCell.Offset(-1, 0).Select

If FoundCell Is Nothing Then
'this shouldn't happen!
Beep
Else
Me.TextBox1.Value = FoundCell.Offset(0, 1).Value
Me.ComboBox1.Value = FoundCell.Offset(0, 1).Value
Me.TextBox2.Value = FoundCell.Offset(0, 2).Value

If IsDate(FoundCell.Offset(0, 0).Value) Then
Me.TextBox1.Value = Format(FoundCell.Offset(0, 0).Value, "dd-mmm-yy")
Else
Me.TextBox1.Value = ""
Me.TextBox2.Value = ""
End If
End If
End Sub

Your code is modified. Could check it over.
Many thanks

--
Bob


"DILipandey" wrote:

Hi Bob,

Try following:-
To select next up row:-
ActiveCell.Offset(-1, 0).EntireRow.Select
To Select next down rol:-
ActiveCell.Offset(1, 0).EntireRow.Select
Thanks.
--
Click on Yes, if it is useful.

Thanks & Best Regards,
Dilip Kumar Pandey
MBA, BCA, B.Com(Hons.)


New Delhi, India


"Bob" wrote:


--
Bob



All times are GMT +1. The time now is 02:23 AM.

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