tdmcfly
08-25-2014, 02:12 PM
Here's the breakdown
- Header is stored in Sheet1, a2:ch2
- Sheet 2 and Sheet 3 do not have headers
- Sheet 3 may exist in some workbooks, but might not in others.
- Want to copy header in Sheet 1 to Sheet 2 and 3, and shift down all the rest
So far, I've got this......
----
Sub Add_Header()
Dim wBook As Workbook
Set wBook = Workbooks.Open("C:\CCT\TEMP\T\ABCDEFG.xls")
Sheets("Sheet1").Select
Range("A1:CH1").Select
Selection.Copy
Sheets("Sheet2").Select
Selection.Insert Shift:=xlDown
Sheets("Sheet1").Select
Range("A1:CH1").Select
Selection.Copy
Sheets("Sheet2").Select
Selection.Insert Shift:=xlDown
wBook.Save
Sheets("Sheet3").Select
Range("A1").Select
Selection.Insert Shift:=xlDown
wBook.Save
End Sub
----
Getting '1004 errors.. =(
Thanks in advance
- Header is stored in Sheet1, a2:ch2
- Sheet 2 and Sheet 3 do not have headers
- Sheet 3 may exist in some workbooks, but might not in others.
- Want to copy header in Sheet 1 to Sheet 2 and 3, and shift down all the rest
So far, I've got this......
----
Sub Add_Header()
Dim wBook As Workbook
Set wBook = Workbooks.Open("C:\CCT\TEMP\T\ABCDEFG.xls")
Sheets("Sheet1").Select
Range("A1:CH1").Select
Selection.Copy
Sheets("Sheet2").Select
Selection.Insert Shift:=xlDown
Sheets("Sheet1").Select
Range("A1:CH1").Select
Selection.Copy
Sheets("Sheet2").Select
Selection.Insert Shift:=xlDown
wBook.Save
Sheets("Sheet3").Select
Range("A1").Select
Selection.Insert Shift:=xlDown
wBook.Save
End Sub
----
Getting '1004 errors.. =(
Thanks in advance