Public DestinationSheet As Worksheet
Public LastrowPlus1 As Long
Sub hailshort()
'
' define source range
'
'' Set DestinationSheet = Worksheets("Macro") ' <--- Set this to desired sheet
Set DestinationSheet = Worksheets(ActiveSheet.Name) ' <--- Set this to desired sheet
'
With DestinationSheet
LastrowPlus1 = .Range("E" & Rows.Count).End(xlUp).Row + 1 ' Find LastRow of Column E on 'Macro' sheet and add 1 to the count
'
Worksheets("hail").Range("N2:N17").Copy ' Copy N2:N17 from 'hail' sheet to 'macro' sheet Column C LastRowPlus1
.Range("C" & LastrowPlus1).PasteSpecial Paste:=xlValues
'
Worksheets("hail").Range("C2:C17").Copy ' Copy C2:C17 from 'hail' sheet to 'macro' sheet Column D LastRowPlus1
.Range("D" & LastrowPlus1).PasteSpecial Paste:=xlValues
'
Worksheets("hail").Range("E2:E17").Copy ' Copy E2:E17 from 'hail' sheet to 'macro' sheet Column E LastRowPlus1
.Range("E" & LastrowPlus1).PasteSpecial Paste:=xlValues
'
Worksheets("hail").Range("D2:D17").Copy ' Copy D2:D17 from 'hail' sheet to 'macro' sheet Column F LastRowPlus1
.Range("F" & LastrowPlus1).PasteSpecial Paste:=xlValues
End With
'
Call sort
MsgBox "Done"
End Sub
Sub sort()
'
' sort Macro
'
Application.CutCopyMode = False
'
For RowOffset = LastrowPlus1 To LastrowPlus1 + 14 Step 2
Range("J" & RowOffset) = "x"
Next
'
DestinationSheet.sort.SortFields.Clear
'
DestinationSheet.sort.SortFields.Add Key:=Range("J" & LastrowPlus1 & ":J" & LastrowPlus1 + 16), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
'
With DestinationSheet.sort
.SetRange Range("C" & LastrowPlus1 - 1 & ":J" & LastrowPlus1 + 16)
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
'
Range("K" & LastrowPlus1 & ":K" & LastrowPlus1 + 15).Borders.LineStyle = xlNone ' Fix Column K borders
'
Range("J" & LastrowPlus1 & ":J" & LastrowPlus1 + 7).ClearContents
'
With Range("D" & LastrowPlus1 & ":D" & LastrowPlus1 + 15)
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 2
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
'
Range("F" & LastrowPlus1 & ":F" & LastrowPlus1 + 15).NumberFormat = "[<=9999999]###-####;(###) ###-####"
'
With Range("H" & LastrowPlus1 & ":H" & LastrowPlus1 + 15).Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorAccent3
.TintAndShade = 0.799981688894314
End With
'
Range("B" & LastrowPlus1).Select
ActiveCell.FormulaR1C1 = "8:00 AM"
Range("B" & LastrowPlus1).AutoFill Destination:=Range("B" & LastrowPlus1 & ":B" & LastrowPlus1 + 3), Type:=xlFillDefault
'
Range("B" & LastrowPlus1 + 4).Select
ActiveCell.FormulaR1C1 = "1:00 PM"
Range("B" & LastrowPlus1 + 4).AutoFill Destination:=Range("B" & LastrowPlus1 + 4 & ":B" & LastrowPlus1 + 7), Type:=xlFillDefault
'
Range("B" & LastrowPlus1 + 4 & ":B" & LastrowPlus1 + 7).Select
Range("B" & LastrowPlus1 & ":B" & LastrowPlus1 + 7).Copy
'
Range("B" & LastrowPlus1 + 8).Select
ActiveSheet.Paste
'
Application.CutCopyMode = False
'
With Range("B" & LastrowPlus1 & ":G" & LastrowPlus1 + 7).Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 15071487
End With
'
With Range("B" & LastrowPlus1 + 8 & ":G" & LastrowPlus1 + 15).Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 15648990
End With
'
Range("E" & LastrowPlus1 + 19).Select
With Range("A" & LastrowPlus1 & ":A" & LastrowPlus1 + 7).Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 15071487
End With
'
With Range("A" & LastrowPlus1 + 8 & ":A" & LastrowPlus1 + 15).Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 15648990
End With
'
Set CellRangeToAddBordersTo = Range("A" & LastrowPlus1 & ":I" & LastrowPlus1 + 15)
'
For Each Cel In CellRangeToAddBordersTo
With Cel.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.Weight = xlThin
End With
'
With Cel.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.Weight = xlThin
End With
'
With Cel.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.Weight = xlThin
End With
'
With Cel.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.Weight = xlThin
End With
Next
'
Range("E" & LastrowPlus1 + 23).Select
End Sub