+ Reply to Thread
Results 1 to 3 of 3

Transfer option value and textbox value into a same cell

Hybrid View

edgaryp Transfer option value and... 05-30-2013, 12:18 AM
AlphaFrog Re: Transfer option value and... 05-30-2013, 01:37 AM
edgaryp Re: Transfer option value and... 05-30-2013, 09:19 PM
  1. #1
    Registered User
    Join Date
    05-29-2013
    Location
    Melbourne
    MS-Off Ver
    Excel 2007
    Posts
    11

    Question Transfer option value and textbox value into a same cell

    Hi,

    I have 2 options and 1 textbox on the suerform, user can chose options or manually enter the data into the textbox, and all the value will be transferred to a same cell H3, here is how I want it to work.

    If none of the options selected or no date entered in textbox then popup a messagebox says "Please enter/chose your name?",
    If one of the options selected and no data entered in textbox then transfer option value to cell H3,
    If none of the options selected but data entered in textbox then transfer the textbox data to cell H3,
    If one of the options selected and data entered in textbox then only transfer the textbox data to cell H3.

    Thank you in advance.

    Ed

    Private Sub OkButton_Click()
    If OptionButton2 Then Range("H3") = "Peter"
    If OptionButton3 Then Range("H3") = "Matt"
    End If
    
    
    Range("H3") = TextBox1.Text
    
    End Sub

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,652

    Re: Transfer option value and textbox value into a same cell

    Private Sub OkButton_Click()
        With Range("H3")
            If Len(Textbox1.Value) Then
                .Value = Textbox1.Text
            ElseIf OptionButton2 Then
                .Value = "Peter"
            ElseIf OptionButton3 Then
                .Value = "Matt"
            Else
                MsgBox "Please enter/choose your name? ", , "Invalid Entry"
            End If
        End With
    End Sub

  3. #3
    Registered User
    Join Date
    05-29-2013
    Location
    Melbourne
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Transfer option value and textbox value into a same cell

    Hi AlphaFrog, it works perfectly, thank you so much !!!!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1