Entering a cells value in a textbox

Todd_M

Board Regular
Joined
Feb 24, 2002
Messages
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?
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Private Sub UserForm_Initialize()

Sheets(TextBox3.Text).Activate

TextBox2.Text = [E7000].End(xlUp)


End Sub



Ivan
 
Upvote 0
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??
 
Upvote 0
Private Sub UserForm_Initialize()

Sheets(TextBox3.Text).Activate

TextBox2.Text = [E7000].End(xlUp)
TextBox1.Text = [E7000].End(xlUp).Offset(0, -3)

End Sub


Ivan
 
Upvote 0

Forum statistics

Threads
1,214,426
Messages
6,119,417
Members
448,895
Latest member
omarahmed1

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top