Hajduk1908
New Member
- Joined
- Aug 16, 2015
- Messages
- 13
Hello I have a macro that loops through selected worksheets in my workbook, deletes the top ten rows and exports it as a CSV. The macro button is on separate worksheet called Monday however I would look like the macro to ignore this worksheet called Monday as this is my control worksheet,
I have tried a few things but unable to get it to work.
Sub Test_loop()
ActiveWorkbook.Save
Dim ws As Worksheet
Dim path As String
path = ActiveWorkbook.path & "\" & Left(ActiveWorkbook.Name, InStr(ActiveWorkbook.Name, ".") - 1)
' Loop through all selected sheets.
For Each ws In ActiveWindow.SelectedSheets
ws.Rows("1:10").Delete ' Delete 10 rows at top of each sheet.
ws.Copy
Range("A1").Interior.Color = 1 ' Format A1 so the top rows are included in the used range and saved
ActiveWorkbook.SaveAs Filename:=path & "_" & ws.Name & ".csv", FileFormat:=xlCSV, CreateBackup:=False
ActiveWorkbook.Close SaveChanges = False
Next ws
End Sub
I have tried a few things but unable to get it to work.
Sub Test_loop()
ActiveWorkbook.Save
Dim ws As Worksheet
Dim path As String
path = ActiveWorkbook.path & "\" & Left(ActiveWorkbook.Name, InStr(ActiveWorkbook.Name, ".") - 1)
' Loop through all selected sheets.
For Each ws In ActiveWindow.SelectedSheets
ws.Rows("1:10").Delete ' Delete 10 rows at top of each sheet.
ws.Copy
Range("A1").Interior.Color = 1 ' Format A1 so the top rows are included in the used range and saved
ActiveWorkbook.SaveAs Filename:=path & "_" & ws.Name & ".csv", FileFormat:=xlCSV, CreateBackup:=False
ActiveWorkbook.Close SaveChanges = False
Next ws
End Sub