+ Reply to Thread
Results 1 to 3 of 3

Form TextBox Transfer to Spreadsheet

  1. #1
    Registered User
    Join Date
    11-21-2005
    Posts
    12

    Form TextBox Transfer to Spreadsheet

    I have a Form with multiple text boxes that I want to transfer to the spreadsheet once the form is filled out. I've used the following macro but it gets hung up.

    Private Sub cmdClose_Click()
    Dim i As Integer
    Dim myNail(84)
    Dim TextBox(84)
    For i = 0 To 84

    Sheets("Haven OSAS").Select
    Range("C" & i + 1).Select
    Selection = TextBox(i).Value * Here is where it gets stuck
    Next i
    Unload Me
    Sheets("Haven ME").Select

    Range("A1").Select

    End Sub

    It doesn't recognize the TextBox(i).Value and stops the macro. If I put in TextBox1.Value it works but I need to do this 85 times and trying to save time.

  2. #2
    Tom Ogilvy
    Guest

    Re: Form TextBox Transfer to Spreadsheet

    Selection = me.controls("TextBox" & i+1).Value

    Assumes by Form you mean Userform and the textboxes are named Textboxes are
    named line TextBox1.

    If the textboxes are on a sheet.

    Selection = Worksheets("Data Entry").OleObjects("Textbox" & i +
    1).Object.Value

    --
    Regards,
    Tom Ogilvy

    "Excellant" <[email protected]> wrote
    in message news:[email protected]...
    >
    > I have a Form with multiple text boxes that I want to transfer to the
    > spreadsheet once the form is filled out. I've used the following macro
    > but it gets hung up.
    >
    > Private Sub cmdClose_Click()
    > Dim i As Integer
    > Dim myNail(84)
    > Dim TextBox(84)
    > For i = 0 To 84
    >
    > Sheets("Haven OSAS").Select
    > Range("C" & i + 1).Select
    > Selection = TextBox(i).Value * Here is where it gets
    > stuck
    > Next i
    > Unload Me
    > Sheets("Haven ME").Select
    >
    > Range("A1").Select
    >
    > End Sub
    >
    > It doesn't recognize the TextBox(i).Value and stops the macro. If I
    > put in TextBox1.Value it works but I need to do this 85 times and
    > trying to save time.
    >
    >
    > --
    > Excellant
    > ------------------------------------------------------------------------
    > Excellant's Profile:

    http://www.excelforum.com/member.php...o&userid=28963
    > View this thread: http://www.excelforum.com/showthread...hreadid=486909
    >




  3. #3
    Registered User
    Join Date
    11-21-2005
    Posts
    12

    Smile Thank you

    Thank you for a prompt response. I changed it and it worked like a charm.

+ 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