(beginer) vba textbox to enter data in a cell
MZ Tools makes life easier for the Excel VBA coder
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 7 of 7

Thread: (beginer) vba textbox to enter data in a cell

  1. #1
    Board Regular
    Join Date
    Mar 2002
    Location
    Arkansas
    Posts
    358
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

     
    Hi all, My question is After making a userform with textboxes, How to get the data that someone has entered in the textbox, to a cell in a excel spreadsheet. Say I had a textbox named (Test), and whatever the person put in that box,I wanted it to go to Sheet 2 Cell ("A6"). Thx Dan

  2. #2
    MrExcel MVP
    Colo's Avatar
    Join Date
    Mar 2002
    Location
    Kobe, Japan
    Posts
    1,456
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi. How about this...

    'Write in UserForm Module
    Private Sub TEST_AfterUpdate()
    Sheets("Sheet2").Range("A6").Value = TEST.Text
    End Sub

  3. #3
    Board Regular
    Join Date
    Mar 2002
    Location
    Arkansas
    Posts
    358
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Thank you so much Colo. Sometimes hard to find answers. Have a good evening. Dan

  4. #4
    New Member
    Join Date
    Mar 2002
    Location
    London
    Posts
    20
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    following up on this - can anyone tell me how to ensure that the textbox value is numeric and not alphabetic?

  5. #5
    Board Regular
    Join Date
    Mar 2002
    Location
    Arkansas
    Posts
    358
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    If I could follow up on my question. I noticed every time I run the userform, It eraces the previous information entered. Any way of keeping the information viewable (when reopening the form), and giving the the User the option of changing the information If req. Thx Dan

  6. #6
    Rest in Peace
    Join Date
    Feb 2002
    Posts
    1,582
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    How about

    Private Sub TEST_AfterUpdate()
    If IsNumeric(Test) Then
    Sheets("Sheet2").Range("A6").Value = Test.Value
    Else
    MsgBox "Numbers only please"
    Test.SetFocus
    End If
    End Sub

  7. #7
    Board Regular
    Join Date
    Mar 2002
    Location
    Arkansas
    Posts
    358
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    Thanks Again all Many thanks !. Have a good evening. Dan

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
  •  

 

 
DMCA.com