Hi, ARGK,
your macro could be reduced to
Sub SplitColumnsToSheets()
With Sheets("Raw Data")
.Range("A:C").Copy
Sheets("Sheet1").Range("A1").PasteSpecial xlPasteValues
.Range("D:F").Copy
Sheets("Sheet2").Range("A1").PasteSpecial xlPasteValues
.Range("G:I").Copy
Sheets("Sheet3").Range("A1").PasteSpecial xlPasteValues
End With
End Sub
@pratik4891:
In case the columns arenīt specified before you could rely on the vertical pagebreaks in the sheet to add the data to the sheets. As I worked with the sample workbook I just copied over the entire columns which could be reduced to the used range of the worksheet:
Sub EF967536()
Dim lngCounter As Long
Dim lngStart As Long
With Sheets("Raw Data")
lngCounter = 1
lngStart = 1
Do While lngCounter <= .VPageBreaks.Count
.Range(.Cells(1, lngStart), .Cells(1, .VPageBreaks.Item(lngCounter).Location(lngCounter).Column - 1)).EntireColumn.Copy
Sheets("Sheet" & lngCounter).Range("A1").PasteSpecial xlPasteValues
lngStart = .VPageBreaks.Item(lngCounter).Location(lngCounter).Column
lngCounter = lngCounter + 1
Loop
.Range(.Cells(1, lngStart), .Cells(1, .Cells(1, Columns.Count).End(xlToLeft).Column)).EntireColumn.Copy
Sheets("Sheet" & lngCounter).Range("A1").PasteSpecial xlPasteValues
End With
End Sub
Ciao,
Holger
Bookmarks