I have the following code
Sub ExplodeWB()
Application.ScreenUpdating = False
Dim wbNew As Workbook
Dim ws As Worksheet
Dim strPath As String
Dim strFileName As String
strPath = ThisWorkbook.Path
For Each ws In ThisWorkbook.Worksheets
strFileName = ws.Range("q6").Value & ".csv"
Range("Q7:Z18").Select
Selection.Copy
Workbooks.Add
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Columns("B:J").Select
Columns("B:J").EntireColumn.AutoFit
Range("A1").Select
Set wbNew = ActiveWorkbook
With wbNew
.SaveAs strPath & "/" & strFileName
.Close False
End With
Next ws
Application.ScreenUpdating = True
MsgBox "All Done"
End Sub
what this should do is copy the range specified to a new file and save as a csv file with the name from a specific cell specified. But while it is saving all the files correctly, it keeps copying the same data into the csv file. Can anyone please help with this code?
thanks in advance
Bookmarks