Hi,
I wonder whether someone may be able to help me please.
From searching on the web I've found the script below which copies a range of columns from a specific row, until the last, creates a new workbook and copies the data into the new workbook.
The code works, but there are just some tweaks that I'd like to make, but I admit I'm a little rusty on VB.
Rather than just copying the columns A and D I'd like to copy columns A, C and D.
I just wonder whether someone may be able to look at this please, and offer some guidance on how I can change.
Many thanks and kind regards
Chris
I wonder whether someone may be able to help me please.
From searching on the web I've found the script below which copies a range of columns from a specific row, until the last, creates a new workbook and copies the data into the new workbook.
Code:
Dim lRow, lCol As Integer
Sheets("Amalgamation of Search").Select
lRow = Range("A" & Rows.Count).End(xlUp).Row
lCol = Cells(1, Columns.Count).End(xlToLeft).Column
For Each cell In Range(Cells(, "D"), Cells(1, lCol))
Union(Range("A1:A" & lRow), Range(Cells(1, cell.Column), Cells(lRow, cell.Column))).Copy
Workbooks.Add
Range("A1").PasteSpecial
ActiveWorkbook.SaveAs Filename:="\\c\s\CAF1\DD\DDCOPS\SC Data.xls"
Next cell
Application.CutCopyMode = False
End Sub
The code works, but there are just some tweaks that I'd like to make, but I admit I'm a little rusty on VB.
Rather than just copying the columns A and D I'd like to copy columns A, C and D.
I just wonder whether someone may be able to look at this please, and offer some guidance on how I can change.
Many thanks and kind regards
Chris
Last edited: