Consulting

Results 1 to 5 of 5

Thread: Solved: Data from Userform to spreadsheet

  1. #1

    Solved: Data from Userform to spreadsheet

    Hiya People


    Basically I have a form which users enter info into via text boxes, and selecting lstbox options etc, I want to be able to click a button and tranfer some of this data to specifc cells within a spreadsheet, any ideas on how to do it.

    cheers

  2. #2
    VBAX Expert
    Joined
    Jul 2004
    Location
    Wilmington, DE
    Posts
    600
    Location
    Here is simple code that transfers data to the first empty row in the sheet:


    [vba]
    Dim LastR As Long
    Dim ws As Worksheet

    Set ws = ThisWorkbook.Worksheets("foo")
    LastR = ws.Cells(ws.Rows.Count, 1).End(xlUp).Row + 1

    Cells(LastR, 1) = Me.Text1
    Cells(LastR, 2) = Me.Text2
    Cells(LastR, 3) = Me.Text3
    [/vba]
    Regards,

    Patrick

    I wept for myself because I had no PivotTable.

    Then I met a man who had no AutoFilter.

    Microsoft MVP for Excel, 2007 & 2008

  3. #3
    Thanks for info, any idea how to specficy exact cells?

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    That is exact cells, Patrick just works out the next row to place them.

    You could also try

    [vba]

    Range("A1").Value = Me.Textbox1.Text
    [/vba]

  5. #5
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,060
    Location
    or you could use the offset command to place data in certain cells in a known row and or column once your initial input cell is selected.

    Ted
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

Posting Permissions

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