Hello again,
I have a macro that copies information from a form, with a submit button, on one sheet and posts the data to another sheet. When I hit submit, it transfers the data to the new sheet and clears the form, however it will always over-write the existing data on the target sheet instead of finding the blank row.
Column A in my target sheet is empty. All Data on my target sheet is in column B-I.
Thank you.
Sub Store_Data()
' Michael is the coolest
' Takes data from one worksheet and stores in the next empty row on another Worksheet
Dim sourceSheet As Worksheet
Dim dataSheet As Worksheet
Dim nextRow As Long
' Make some sheet variables so we can use those instead of hard-coding sheet reference
Set sourceSheet = Sheets("Request")
Set dataSheet = Sheets("TimeOff")
' Get the next empty row from the Data sheet.
nextRow = dataSheet.Range("A" & dataSheet.Rows.Count).End(xlUp).Offset(1).Row
'Input the form values into the Data Sheet.
dataSheet.Cells(nextRow, 2).Value = sourceSheet.Range("C4").Value
dataSheet.Cells(nextRow, 3).Value = sourceSheet.Range("F4").Value
dataSheet.Cells(nextRow, 4).Value = sourceSheet.Range("C6").Value
dataSheet.Cells(nextRow, 5).Value = sourceSheet.Range("F6").Value
dataSheet.Cells(nextRow, 6).Value = sourceSheet.Range("C8").Value
dataSheet.Cells(nextRow, 7).Value = sourceSheet.Range("F8").Value
dataSheet.Cells(nextRow, 8).Value = sourceSheet.Range("C10").Value
dataSheet.Cells(nextRow, 9).Value = sourceSheet.Range("C12").Value
'Clear Date
sourceSheet.Range("C4").Value = ""
sourceSheet.Range("F4").Value = ""
sourceSheet.Range("C6").Value = ""
sourceSheet.Range("F6").Value = ""
sourceSheet.Range("C8").Value = ""
sourceSheet.Range("F8").Value = ""
sourceSheet.Range("C10").Value = ""
sourceSheet.Range("C12").Value = ""
End Sub