![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Feb 2002
Posts: 117
|
Hi-
Im trying to enter the value of a cell into a textbox on a userform. This is the code that initializes when the userform is shown: Private Sub UserForm_Initialize() Sheets(TextBox3.Text).Activate ActiveSheet.Visible = True [e7000].End(xlUp).Offset(0, 0).Select TextBox2.Text = Range.Offset(0, 0).Value End Sub The value of the cell that is selected using the line:[e7000].End(xlUp).Offset(0, 0).Select . This finds the cell that im looking for, but I cant seem to figure out how to list it in textbox2. As you can see Ive tried a code(tried many other ways also) to show the value, but its not working. Perhaps I should use the offset methode, but im not sure how to apply it to this code. Please help? |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
|
Private Sub UserForm_Initialize()
Sheets(TextBox3.Text).Activate TextBox2.Text = [E7000].End(xlUp) End Sub Ivan |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Feb 2002
Posts: 117
|
Thanks Ivan- This worked well. One more question to complete this code:
Private Sub UserForm_Initialize() Sheets(TextBox3.Text).Activate TextBox2.Text = [E7000].End(xlUp) TextBox1.Text = Offset(-2, 0) End Sub In textbox1 of the user form Im trying to show the value of the cell three columns to the left(Column "b") of the cell that was listed in textbox2. Im asuming to use the offset method but not sure how to write it?? |
|
|
|
|
|
#4 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
|
Private Sub UserForm_Initialize()
Sheets(TextBox3.Text).Activate TextBox2.Text = [E7000].End(xlUp) TextBox1.Text = [E7000].End(xlUp).Offset(0, -3) End Sub Ivan |
|
|
|
|
|
#5 |
|
Board Regular
Join Date: Feb 2002
Posts: 117
|
Thanks again Ivan, This work well!!!!
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|