+ Reply to Thread
Results 1 to 9 of 9

Why is my userform not inserting the data??

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    04-19-2013
    Location
    Yorkshire, England
    MS-Off Ver
    Excel 2010
    Posts
    297

    Why is my userform not inserting the data??

    Yesterday the userform and code I have used was recording the data fine, now this morning it is not working and I cannot find out why.

    I have attached the file if there is anyone kind enough to take a look at it...because I am at a loss.

    It's userform1 and
    Private Sub CommandButton1_Click()
    Thanks in advance to anyone who takes the time to help

    Strud
    Attached Files Attached Files

  2. #2
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Why is my userform not inserting the data??

    Hi Strud,
    try it
    ...
    Worksheets("Record").Cells(Rows.Count, 5).End(xlUp)(2).Resize(, 4).Value = _
    Array(txt_Date.Value, txt_Initials.Value, txt_StockCategory.Value, txt_Notes.Value)
    'RowCount = Worksheets("Record").Range("E5").CurrentRegion.Rows.Count
    'With Worksheets("Record").Range("E5")
    '    .Offset(RowCount, 1).Value = Me.txt_Initials.Value
    '    .Offset(RowCount, 0).Value = Me.txt_Date.Value
    '    .Offset(RowCount, 2).Value = Me.txt_StockCategory.Value
    '    .Offset(RowCount, 3).Value = Me.txt_Notes.Value
    'End With
    ...

  3. #3
    Forum Contributor
    Join Date
    04-19-2013
    Location
    Yorkshire, England
    MS-Off Ver
    Excel 2010
    Posts
    297

    Re: Why is my userform not inserting the data??

    Hi Nilem, thanks for the swift response.

    Did you test it because I couldn't get it work..?

  4. #4
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Why is my userform not inserting the data??

        RowCount = Worksheets("Record").Cells(Rows.Count, "E").End(xlUp).Row + 1
        With Worksheets("Record").Range("E" & RowCount)
                .Offset(0, 1).Value = Me.txt_Initials.Value
                .Offset(0, 0).Value = Me.txt_Date.Value
                .Offset(0, 2).Value = Me.txt_StockCategory.Value
                .Offset(0, 3).Value = Me.txt_Notes.Value
        End With
    If solved remember to mark Thread as solved

  5. #5
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Why is my userform not inserting the data??

    Of course, it works for me in your example

  6. #6
    Forum Contributor
    Join Date
    04-19-2013
    Location
    Yorkshire, England
    MS-Off Ver
    Excel 2010
    Posts
    297

    Re: Why is my userform not inserting the data??

    could you possibly attach it please so I can see if it's just my file then...

  7. #7
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Why is my userform not inserting the data??

    note row 301, 302, etc. on a "Record" sheet (just clean these lines)

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

    Re: Why is my userform not inserting the data??

    Make sure you delete any previous-code data from rows 300+ for these solutions to work.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  9. #9
    Forum Contributor
    Join Date
    04-19-2013
    Location
    Yorkshire, England
    MS-Off Ver
    Excel 2010
    Posts
    297

    Re: Why is my userform not inserting the data??

    Quote Originally Posted by AlphaFrog View Post
    Make sure you delete any previous-code data from rows 300+ for these solutions to work.
    Quote Originally Posted by nilem View Post
    note row 301, 302, etc. on a "Record" sheet (just clean these lines)
    Thanks guys I didn't see that- that's sorted it.

    Cheers again- lifesavers!!

+ 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