Hello All Helpers
My code works great, However I'd like to add a second function. Once its added it overwrites the previous functions data. How can i adjust the code to add the data to the next available row?
Function vacation()
Dim sheetSource, shetDest As Worksheet
Dim rowSource, rowDest As Integer
Dim strcomments As String
Set sheetSource = Sheets("Vacation data")
rowSource = 4
Set shetDest = Sheets("Vacation load")
rowDest = 9
While sheetSource.Cells(rowSource, 4).Formula <> ""
strcomments = sheetSource.Cells(rowSource, 5).Value
boolAddToSheet = False
Select Case strcomments
Case Is >= 32
shetDest.Cells(rowDest, 6).Value = sheetSource.Cells(rowSource, 2).Value 'hours
shetDest.Cells(rowDest, 8).Value = sheetSource.Cells(rowSource, 5).Value 'employee id
shetDest.Cells(rowDest, 13).Value = sheetSource.Cells(rowSource, 8).Value 'shift
shetDest.Cells(rowDest, 14).Value = sheetSource.Cells(rowSource, 9).Value 'check group
rowDest = rowDest + 1
End Select
rowSource = rowSource + 1
Wend
End Function
My code works great, However I'd like to add a second function. Once its added it overwrites the previous functions data. How can i adjust the code to add the data to the next available row?
Function vacation()
Dim sheetSource, shetDest As Worksheet
Dim rowSource, rowDest As Integer
Dim strcomments As String
Set sheetSource = Sheets("Vacation data")
rowSource = 4
Set shetDest = Sheets("Vacation load")
rowDest = 9
While sheetSource.Cells(rowSource, 4).Formula <> ""
strcomments = sheetSource.Cells(rowSource, 5).Value
boolAddToSheet = False
Select Case strcomments
Case Is >= 32
shetDest.Cells(rowDest, 6).Value = sheetSource.Cells(rowSource, 2).Value 'hours
shetDest.Cells(rowDest, 8).Value = sheetSource.Cells(rowSource, 5).Value 'employee id
shetDest.Cells(rowDest, 13).Value = sheetSource.Cells(rowSource, 8).Value 'shift
shetDest.Cells(rowDest, 14).Value = sheetSource.Cells(rowSource, 9).Value 'check group
rowDest = rowDest + 1
End Select
rowSource = rowSource + 1
Wend
End Function