RedOctoberKnight
Board Regular
- Joined
- Nov 16, 2015
- Messages
- 150
- Office Version
- 2016
- Platform
- Windows
Good Morning,
I have a worksheet that copies and pastes from another workbook. It works perfectly except for when I need to "pull" the information again. I get a merged cell error. So i'm trying to figure out how to unmerge range (A1:S100) and then have it copy the info.
I get an error with my following code. I'm not sure where to put the unmerge action.
Any help would be much appreciated and as always, thank you.
I have a worksheet that copies and pastes from another workbook. It works perfectly except for when I need to "pull" the information again. I get a merged cell error. So i'm trying to figure out how to unmerge range (A1:S100) and then have it copy the info.
I get an error with my following code. I'm not sure where to put the unmerge action.
VBA Code:
Public Sub Copy_Range_From_Truck_Schedules()
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Dim tsWorkbook As Workbook
Set tsWorkbook = Workbooks.Open(ThisWorkbook.Path & "\truckschedulesdualsides.xlsx")
With ThisWorkbook.ActiveSheet
tsWorkbook.Worksheets(.Name).Range("A1:S100").Copy
.Range("A1:S100").UnMerge
.Range("A1").PasteSpecial xlPasteValues
.Range("A1").PasteSpecial xlPasteFormats
.Range("H:J").EntireColumn.AutoFit
.Range("M:O").EntireColumn.AutoFit
.Range("R:R").EntireColumn.ColumnWidth = 25
End With
tsWorkbook.Close False
Application.DisplayAlerts = True
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub
Any help would be much appreciated and as always, thank you.