My workbook was finished or so I thought. Anyway, I'm wanting to add some code to do some sheet copying. I have 11 sheets, two sheets a week, plus the main sheet. What I'm wanting to do is copy these sheets to another workbook based on a cell value. I just tried to do the following:
Sheet1.select (this sheet will always be copied)
Sheet2.Activate
If Range("B9") <> " " then
Sheet2.Select
Sheet7.select
end if
Sheet3.Activate
If Range("B9") <> " " Then
Sheet3.Select
Sheet8.Select
end if
Sheet4.Activate
If Range("B9") <> " " Then
Sheet4.Select
Sheet9.Select
end if
Sheet5.Activate
If Range("B9") <> " " Then
Sheet5.Select
Sheet10.Select
End if
Selection.Copy
ActiveWorkbook.SaveAs "FileName"
I get an error with the above code. What am I doing wrong.
Sheet1.select (this sheet will always be copied)
Sheet2.Activate
If Range("B9") <> " " then
Sheet2.Select
Sheet7.select
end if
Sheet3.Activate
If Range("B9") <> " " Then
Sheet3.Select
Sheet8.Select
end if
Sheet4.Activate
If Range("B9") <> " " Then
Sheet4.Select
Sheet9.Select
end if
Sheet5.Activate
If Range("B9") <> " " Then
Sheet5.Select
Sheet10.Select
End if
Selection.Copy
ActiveWorkbook.SaveAs "FileName"
I get an error with the above code. What am I doing wrong.