I have the below code, but when I run the macro, it seems to ignore the fact that I've excluded the "Input" sheet. Any ideas? I'm aware there are probably other errors in the preceding code, but I'd like to fix this first!
Sub export_all()
Dim Path As String
Dim Name As String
Dim ws As Worksheet
Path = Workbooks("CGL Configurator V3.xlsm").Sheets("Input").Range("$C$12")
Name = ActiveSheet.Range("A151")
For Each ws In ThisWorkbook.Worksheets
If ws.Name <> "Input" Then
Range("A1:AZ151").Copy
Workbooks.Add
Range("A1").PasteSpecial Paste:=xlPasteValues
ActiveWorkbook.SaveAs Filename:=Path & "\" & Name & ".csv", FileFormat:=xlCSVUTF8
Range("A151").Delete
ActiveWorkbook.Save
ActiveWorkbook.Close
End If
Next ws
Workbooks("CGL Configurator V3.xlsm").Sheets("Input").Activate
End Sub
If
statement, and then step through your code (F8) to see whats going on. Alternatively, addDebug.Print(ws.Name)
inside thatIf
statement.debug.print ws.Name
on the next line, beforeRange("A1:AZ151").Copy
. Alternatively, use anElse If ws.Name = "Input" then End If