Link to home
Start Free TrialLog in
Avatar of GlobaLevel
GlobaLevelFlag for United States of America

asked on

vba - copy form one workbook to another doesnt work

I am try to copy a range from one workbook to another...but it is not working for me...even though not every cell will have a value....
Dim newXl As Object
Dim wbk As Workbook
Dim ws As Worksheet
Dim strCopy As String
Dim csvPath As String
Dim dcCopyBefore As String
Dim strArray As String


dcCopyBefore = "dcCopyBefore.csv"
  
'Create a directoriy to save new copy of CB Data to
MyPath = "C:\disputedChangesRpts"
If Dir$(MyPath, vbDirectory) = "" Then MkDir MyPath
    
Set newXl = Workbooks.Add
    With newXl
        .Title = "dcCopyBefore"
        .Subject = "dcCopyBefore"
        .SaveAs Filename:="C:\disputedChangesRpts\dcCopyBefore.csv"
    End With
'ActiveWorkbook.Close



Workbooks("dcCopyBefore.csv").Sheets("Sheet1").Range("A6:K65000") = Workbooks("DisputedCharges - Back office interface -v15.xls").Sheets("Disputed Charges").Range("G6:Q65000")

Open in new window

Avatar of Rory Archibald
Rory Archibald
Flag of United Kingdom of Great Britain and Northern Ireland image

What do you mean when you say it's not working? What is happening?
Hello GlobaLevel,

Please explain what you mean by "not working."

Regards,

Patrick
ASKER CERTIFIED SOLUTION
Avatar of Saurabh Singh Teotia
Saurabh Singh Teotia
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial