Consulting

Results 1 to 6 of 6

Thread: Solved: Add new row to spreadsheet

  1. #1

    Solved: Add new row to spreadsheet

    Hi people

    Right basically each time a user does a certain process, I want information within several text boxes to be stored within a spreadsheet permentely, however I want to be excel to use a new row per process, therefore not overwriting the previous record, how do I do this?
    also the information is coming for several UserForms

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    iLastRow = Cells(Rows.Count,"A").End(xlUp).Row + 1
    Range("A" & iLastRow).Value = textbox1.Text
    'etc.
    [/vba]

  3. #3
    Quote Originally Posted by xld
    [vba]

    iLastRow = Cells(Rows.Count,"A").End(xlUp).Row + 1
    Range("A" & iLastRow).Value = textbox1.Text
    'etc.
    [/vba]
    Thanks, however how do I specify which worksheet I want to write to?

    as this coding is going behind a button on a userform

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Quote Originally Posted by bopo
    Thanks, however how do I specify which worksheet I want to write to?

    as this coding is going behind a button on a userform
    [vba]

    With Worksheets("Sheet1")
    iLastRow = .Cells(.Rows.Count,"A").End(xlUp).Row + 1
    .Range("A" & iLastRow).Value = Textbox1.Text
    'etc.
    End With
    [/vba]

  5. #5

  6. #6
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    If you have Option Explicit, iLastRow must be explicitly declared

    [vba]

    Dim iLastRow As Long

    'rest of code
    [/vba]

Posting Permissions

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