dj44
11-15-2016, 07:14 AM
Hi folks,
Good Tuesday all :)
I have a import data issue that Im trying to solve.
17603
I have put the code togther from other code I had.
I'm afraid its gone a bit pear shaped.
Dim i As Long
Dim ws As Worksheet
Dim oSourceWorksheet As Worksheet
Dim oImportToWorksheet As Worksheet
Dim strDir As String
Set ws = Worksheets("ImportList")
For i = 3 To ws.Cells(ws.Rows.Count, "A").End(xlUp).Row
Set oSourceWorksheet = Worksheets(ws.Cells(i, "A").Value)
Set oImportToWorksheet = Application.ActiveWorkbook.Path & Worksheets(ws.Cells(i, "C").Value)
oSourceWorksheet.Range(ws.Cells(i, "C")).Copy Destination:=oImportToWorksheet.Range(ws.Cells(i, "E").Value)
Next i
End Sub
I saw Mr Bruins work, but that copied from 1 worksheet
http://www.rondebruin.nl/win/s3/win001.htm
The reason I need to do it this way is because It has formatting and other bits and bobs like hyperlinks, so if I don’t paste it in - I can import only the raw data and I will lose the good bits.
Is my code on the right track?
Thank you for your advice and time
Good Tuesday all :)
I have a import data issue that Im trying to solve.
17603
I have put the code togther from other code I had.
I'm afraid its gone a bit pear shaped.
Dim i As Long
Dim ws As Worksheet
Dim oSourceWorksheet As Worksheet
Dim oImportToWorksheet As Worksheet
Dim strDir As String
Set ws = Worksheets("ImportList")
For i = 3 To ws.Cells(ws.Rows.Count, "A").End(xlUp).Row
Set oSourceWorksheet = Worksheets(ws.Cells(i, "A").Value)
Set oImportToWorksheet = Application.ActiveWorkbook.Path & Worksheets(ws.Cells(i, "C").Value)
oSourceWorksheet.Range(ws.Cells(i, "C")).Copy Destination:=oImportToWorksheet.Range(ws.Cells(i, "E").Value)
Next i
End Sub
I saw Mr Bruins work, but that copied from 1 worksheet
http://www.rondebruin.nl/win/s3/win001.htm
The reason I need to do it this way is because It has formatting and other bits and bobs like hyperlinks, so if I don’t paste it in - I can import only the raw data and I will lose the good bits.
Is my code on the right track?
Thank you for your advice and time