I have a log that is A:N and varies on how many rows. I have a macro (below) that combines my several logs into one mother log. Problem is, if one of my reps skips a line then this macro will not grab the stuff below that. Is there a way to remove those accidental skips, or would it be better for my macro to be altered to accommodate for those? Even though it is just a blank sheet with a few headers, I have attached what we use.
Sub DCMRCombine()
Dim J As Long, k As Long, r As Range
J = Worksheets.Count
With Worksheets("DCMR")
Set r = Range(.Range("A2"), .Range("A2").End(xlDown))
r.EntireRow.Delete
End With
For k = 1 To J
If Worksheets(k).Name = "DCMR" Then GoTo errorhandler
With Worksheets(k)
If .Range("A2") = "" Then GoTo errorhandler
Set r = Range(.Range("A2"), .Range("A2").End(xlDown))
r.EntireRow.Copy
Worksheets("DCMR").Cells(Rows.Count, "A").End(xlUp).Offset(1, 0).PasteSpecial
End With
errorhandler:
Next k
' Center Macro
'
'
Cells.Select
With Selection
.HorizontalAlignment = xlGeneral
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
With Selection
.HorizontalAlignment = xlCenter
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
End Sub
Bookmarks