Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 5 of 5

Thread: Entering a cells value in a textbox

  1. #1
    Board Regular
    Join Date
    Feb 2002
    Posts
    117
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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. #2
    MrExcel MVP Ivan F Moala's Avatar
    Join Date
    Feb 2002
    Location
    Auckland, New Zealand
    Posts
    4,209
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Private Sub UserForm_Initialize()

    Sheets(TextBox3.Text).Activate

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


    End Sub



    Ivan

  3. #3
    Board Regular
    Join Date
    Feb 2002
    Posts
    117
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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. #4
    MrExcel MVP Ivan F Moala's Avatar
    Join Date
    Feb 2002
    Location
    Auckland, New Zealand
    Posts
    4,209
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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. #5
    Board Regular
    Join Date
    Feb 2002
    Posts
    117
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Thanks again Ivan, This work well!!!!

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •