what I have in columns A, B, C:
Date Hours Name
01/03/2016 8,0 John
02/03/2016 8,0 John
08/03/2016 7,5 John
08/03/2016 2,0 Charles
08/03/2016 2,0 William
10/03/2016 3,5 Charles
11/03/2016 3,7 Charles
14/03/2016 2,2 Charles
15/03/2016 8,0 John
16/03/2016 8,0 John
what I want in column A, B, C in another sheet:
Date Hours Name
01/03/2016 8,0 John
02/03/2016 8,0 John
03/03/2016 0,0 -
04/03/2016 0,0 -
05/03/2016 0,0 -
06/03/2016 0,0 -
07/03/2016 0,0 -
08/03/2016 7,5 John
08/03/2016 2,0 Charles
08/03/2016 2,0 William
09/03/2016 0,0 -
10/03/2016 3,5 Charles
11/03/2016 3,7 Charles
12/03/2016 0,0 -
13/03/2016 0,0 -
14/03/2016 2,2 Charles
15/03/2016 8,0 John
16/03/2016 8,0 John
It has to work with any given dates, hours and names!
Please help I really need this!
Sub proj0()
Dim lRow As Long
Dim Data1, Data2 As Date
Dim C1, C2 As String
Folha11.Select
Columns("a:c").Select
Selection.Copy
Folha13.Select
Range("A1").Select
ActiveSheet.Paste
Cells.Select
Selection.Sort _
Key1:=Range("a2"), Order1:=xlAscending, _
key2:=Range("c2"), Order2:=xlAscending, _
Header:=xlYes, OrderCustom:=1, _
MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
lRow = 2
Do While (Cells(lRow, 1) <> "")
C1 = Cells(lRow, "c")
C2 = Cells(lRow + 1, "c")
Data1 = Cells(lRow, "a")
Data2 = Cells(lRow + 1, "a")
If (Data2 - Data1 > 1) Then
ActiveCell.EntireRow.Insert shift:=xlDown
Cells(lRow + 1, "a").Value = Data1 + 1
Cells(lRow + 1, "b").Value = 0
Cells(lRow + 1, "c").Value = "-"
Else
lRow = lRow + 1
End If
Loop
Range("a:c").Columns.AutoFit
Folha13.Select
I believe i'm close but cant figure the insert part
This does what you suggest:
Sheet14 Before:
Sheet15 After: