![]() |
|
|
Thread Tools | Display Modes |
#2
|
|||
|
|||
![]()
I managed to get the answer. I'll post here just in case somebody has the same problem!
Sub timeline() Dim i As Long Dim ws As Worksheet Dim ts As Worksheet Set ws = Sheets("Sheet15") 'Change to your Output Sheet Set ts = Sheets("Sheet14") 'Change to your data sheet With ws i = ts.Range("A" & ts.Rows.Count).End(xlUp).Row ts.Range("A1:C" & i).Copy .Range("A1") .Range("A1:C" & i).Sort Key1:=.Range("A2"), Order1:=xlAscending, _ key2:=.Range("C2"), Order2:=xlAscending, _ Header:=xlYes Do Until i = 2 If .Cells(i, 1).Value2 = .Cells(i - 1, 1).Value2 Or .Cells(i, 1).Value2 = .Cells(i - 1, 1).Value2 + 1 Then i = i - 1 Else .Rows(i).Insert .Cells(i, 1).Value = .Cells(i + 1, 1).Value2 - 1 .Cells(i, 2).Value = 0# .Cells(i, 3).Value = "--" End If Loop End With End Sub |
Tags |
date, loops, timeline |
Thread Tools | |
Display Modes | |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Autofill dates - how can I get the same date and consecutive dates? | Exhale | Excel | 3 | 04-05-2016 03:11 AM |
![]() |
damaniam | Word VBA | 7 | 02-21-2014 07:12 AM |
![]() |
kilburfi | Word VBA | 2 | 07-12-2013 01:26 AM |
![]() |
mikeg | Project | 1 | 04-19-2013 06:26 AM |
![]() |
Mr Davo | Excel | 1 | 10-29-2012 01:07 AM |