I have a user form designed and now I would like to be able to program a Command Button to "SAVE" and when it is clicked, I would like to save the results of my fields to another worksheet. I have a defined range that I would like to have the inserted row into?
g
Last edited by Patchworks; 07-15-2009 at 04:19 AM.
Ok, I found an article on the net and here is my code to help others...
Private Sub Save_Click() Dim iRow As Long Dim ws As Worksheet Set ws = Worksheets("Forums Postings") 'find first empty row in database iRow = ws.Cells(Rows.Count, 1) _ .End(xlUp).Offset(1, 0).Row 'copy the data to the database ws.Cells(iRow, 1).Value = frmForumsPosting.ForumID.Caption ws.Cells(iRow, 2).Value = frmForumsPosting.ForumURL.Caption ws.Cells(iRow, 3).Value = frmForumsPosting.UserName.Caption ws.Cells(iRow, 4).Value = frmForumsPosting.Entered.Caption ws.Cells(iRow, 5).Value = frmForumsPosting.PostURL.Value ws.Cells(iRow, 6).Value = frmForumsPosting.PostURL.Value ws.Cells(iRow, 8).Value = frmForumsPosting.Notes.Value End Sub
Ok, actually the problem with the above is it doesnt add it to my range so lookup that reference my range won't update?
Can someone help with a solution that adds the new data to the range?
g
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks