ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   UserForm TextBox (https://www.excelbanter.com/excel-programming/396767-userform-textbox.html)

LaDdIe

UserForm TextBox
 
Hi,
I've got a userform with a text box on it, and some comand buttons that move
active cell left or right, How do I program the text box to display the value
the active cell offset by 2 rows, the value happens to be a date.

Thanks for any help.

Regards
Laddie.

Rick Rothstein \(MVP - VB\)

UserForm TextBox
 
Assuming your controls are named with the default names VBA assigns, use
this...

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
With UserForm1
If .Visible = True Then
.TextBox1.Value = ActiveCell.Offset(2, 0).Value
End If
End With
End Sub

in the worksheet code window (**not** the user form code window).

Rick


"LaDdIe" wrote in message
...
Hi,
I've got a userform with a text box on it, and some comand buttons that
move
active cell left or right, How do I program the text box to display the
value
the active cell offset by 2 rows, the value happens to be a date.

Thanks for any help.

Regards
Laddie.



LaDdIe

UserForm TextBox
 
Thanks Rick, Just the job, The rest I can tweak

Regards
LaDdIe

"Rick Rothstein (MVP - VB)" wrote:

Assuming your controls are named with the default names VBA assigns, use
this...

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
With UserForm1
If .Visible = True Then
.TextBox1.Value = ActiveCell.Offset(2, 0).Value
End If
End With
End Sub

in the worksheet code window (**not** the user form code window).

Rick


"LaDdIe" wrote in message
...
Hi,
I've got a userform with a text box on it, and some comand buttons that
move
active cell left or right, How do I program the text box to display the
value
the active cell offset by 2 rows, the value happens to be a date.

Thanks for any help.

Regards
Laddie.





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

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