Hi all,
Currently copying from an external workbook to my working workbook & worksheet.
This is the external worksheet:
My code below splits my column with multiple contract numbers as planned, however I want to be able to go from this:
To this below, where there is data past column D, there is another row added and the data from A:C is replicated and the contract number moves to column D. In addition, all columns past Column D are to be cleared.
Basically, for Contract 40007304, a line gets added (B7 as per below), and the details for Columns A-C for line B6 has been replicated for it. Same goes for all multiple contract #s.
Another complication is that there can be up to 10 unique contract numbers for a customer account, so the goal is for it to be the same as the above.
Current copy-paste VBA is as per below:
Help would be much appreciated on how to append the new code line to the existing one as I'm a bit lost.
Thank you!
Currently copying from an external workbook to my working workbook & worksheet.
This is the external worksheet:
My code below splits my column with multiple contract numbers as planned, however I want to be able to go from this:
To this below, where there is data past column D, there is another row added and the data from A:C is replicated and the contract number moves to column D. In addition, all columns past Column D are to be cleared.
Basically, for Contract 40007304, a line gets added (B7 as per below), and the details for Columns A-C for line B6 has been replicated for it. Same goes for all multiple contract #s.
Another complication is that there can be up to 10 unique contract numbers for a customer account, so the goal is for it to be the same as the above.
Current copy-paste VBA is as per below:
VBA Code:
Sub get_copyt()
Application.ScreenUpdating = False
Dim App As New Excel.Application
Dim wb As Workbook
Dim copy As Range
Dim filter_date As Date
Set wb = ThisWorkbook
Set ws = Sheets("SheetA")
ws.Range("B3:E10000").ClearContents
Set copy_wb = App.Workbooks.Open(Filename:="ABC.csv", UpdateLinks:=True, ReadOnly:=True)
Set sht = wb.Worksheets(1)
Set StartCell = Range("A1")
lastRow = sht.Cells(sht.Rows.Count, StartCell.Column).End(xlUp).Row
lastColumn = sht.Cells(StartCell.Row, sht.Columns.Count).End(xlToLeft).Column
copy_wb.Worksheets("Sheet1").Range("A2:D" & lastRow).Copy
Sheets("SheetA").Range("B3").PasteSpecial Paste:=xlPasteValues
copy_wb.Application.CutCopyMode = False
copy_wb.Close SaveChanges:=False
With ws
.Range("C3:C500").Cut Destination:=ws.Range("E3:E500")
.Range("C3:C500").Delete Shift:=xlToLeft
Set myRng = ws.Range("D3:D" & lastRow)
myRng.TextToColumns _
Destination:=ws.Range("E3:K3"), _
DataType:=xlDelimited, _
Tab:=False, _
Semicolon:=False, _
Comma:=True, _
Space:=False, _
Other:=False
End Sub
Help would be much appreciated on how to append the new code line to the existing one as I'm a bit lost.
Thank you!