I followed the "Idiot-Proof Forms in Excel" videos to create my own excel form, but when I got to Module 2 of the Macro where you put in the code to save the data from the form to another worksheet, one of the lines of code is giving me the 1004 error.
nextRow = dataSheet.Range("A" & dataSheet.Rows.Count).End(x1Up).Offset(1).Row
This is the part of the code that adds the data inputted to the next available row on the spreadsheet. I checked and rechecked my code with the code in the video and even tried to change it a little bit but nothing seems to be working. I was wondering if I'm doing something wrong or if there's another way to write the code that'll have the same function.
Here is my whole Module 2 for reference:
Sub Store_Data()
'Takes data from one worksheet and stores it in the next empty row of another worksheet
Dim sourceSheet As Worksheet
Dim dataSheet As Worksheet
Dim nextRow As Integer
Set sourceSheet = Sheets("Form")
Set dataSheet = Sheets("Data")
nextRow = dataSheet.Range("A" & dataSheet.Rows.Count).End(x1Up).Offset(1).Row
dataSheet.Cells(nextRow, 1).Value = sourceSheet.Range("F4").Value
dataSheet.Cells(nextRow, 2).Value = sourceSheet.Range("F6").Value
dataSheet.Cells(nextRow, 3).Value = sourceSheet.Range("F8").Value
dataSheet.Cells(nextRow, 4).Value = sourceSheet.Range("F10").Value
dataSheet.Cells(nextRow, 5).Value = sourceSheet.Range("F12").Value
dataSheet.Cells(nextRow, 6).Value = sourceSheet.Range("F14").Value
End Sub