Hi, rcicconetti,
maybe try the first part (as I dont recommend to merge cells the bordering and merging is excluded). And rows 13 to 60 make up 48 rows for me while you only add 47 for the next area to copy to...
Sub UpdateSchedule()
'
'
' Update Schedule Macro
Dim lngCtr As Long
Dim lngLine As Long
Dim ws As Worksheet
Set ws = ActiveWorkbook.Worksheets("Scheduling Assistant 1.0")
For lngCtr = 3 To 11 Step 2
With ws.Sort
With .SortFields
.Clear
.Add Key:=ws.Cells(60, lngCtr), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
End With
.SetRange ws.Range(ws.Cells(13, lngCtr), ws.Cells(60, lngCtr))
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Next lngCtr
ws.Unprotect
With Range("N151:U151")
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
.UnMerge
End With
lngLine = 23
For lngCtr = 3 To 11
ws.Cells(13, lngCtr).Resize(48, 1).Copy
ws.Range("N" & lngLine).Resize(48, 1).PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
ws.Range("N" & lngLine).Resize(48, 1).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
lngLine = lngLine + 48
Next lngLine
ws.Range("$N$23:$N$" & lngLine - 48).RemoveDuplicates Columns:=1, Header:=xlNo
With ws.Sort
With .SortFields
.Clear
.Add Key:=ws.Range("N23"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
End With
.SetRange ws.Range("N23:N" & ws.Cells(ws.Rows.Count, "N").End(xlUp).Row)
.Header = xlNo
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
'no further
Code is untested so errors may be raised.
Ciao,
Holger
Bookmarks