If sheet exists and it is named run this code
Jazz, try the below
Dim lngRow As Long, blnInsert As Boolean
lngRow = 2
Select Case ActiveSheet.Name
Case "01", "02", "03", "04", "05", "05a", "06", _
"07", "07a", "08", "09", "10", "10a", "11", _
"12", "12a", "13", "13a", "14", "15", "15a"
Do While lngRow <= Cells(Rows.Count, "G").End(xlUp).Row
blnInsert = Not blnInsert
If blnInsert Then
Rows(lngRow).Insert
Select Case ActiveSheet.Name
Case "01", "02", "03", "04", "05", "05a"
Range("A" & lngRow) = Date - Range("H" & lngRow + 1)
Case "06", "07", "07a", "08", "09", "10", "10a", "11", _
"12", "12a", "13", "13a", "14", "15", "15a"
Range("D" & dateRow) = Date - Range("K" & dateRow + 1)
End Select
End If
lngRow = lngRow + 1
Loop
End Select
If this post helps click Yes
---------------
Jacob Skaria
"Jazz" wrote:
I would like to do the following. Can you assist?
If sheet exists and it is named 01,02,03,04,05,05a, then run this code
Dim lngRow As Long, blnInsert As Boolean
lngRow = 2
Do While lngRow <= Cells(Rows.Count, "G").End(xlUp).Row
blnInsert = Not blnInsert
If blnInsert Then
Rows(lngRow).Insert
Range("A" & lngRow) = Date - Range("H" & lngRow + 1)
End If
lngRow = lngRow + 1
Loop
If sheet exists and it is named
06,07,07a,08,09,10,10a,11,12,12a,13,13a,14,15,15a, then run this code
Dim dateRow As Long, emptInsert As Boolean
dateRow = 2
Do While dateRow <= Cells(Rows.Count, "G").End(xlUp).Row
emptInsert = Not emptInsert
If emptInsert Then
Rows(dateRow).Insert
Range("D" & dateRow) = Date - Range("K" & dateRow + 1)
End If
dateRow = dateRow + 1
Loop
|