Trouble with code

Kell2Jam

New Member
Joined
May 10, 2020
Messages
33
Office Version
  1. 2013
Platform
  1. Windows
I think this code is incorrect, it seems to be pasting the the dates the wrong way around and i know that its something simple but i cant figure it out.

Workbooks.Open "P:\FETS Command\Business Services\STORES OFFICE\James - Work\#LineItemsReport\PurchaseOrders.csv"
Windows("PurchaseOrders.csv").Activate
Dim wsCopy As Worksheet
'Dim wsDest As Worksheet
'Dim lCopyLastRow As Long
'Dim lDestLastRow As Long
'Dim strPath As String

Set wsCopy = Workbooks("PurchaseOrders.csv").Worksheets("PurchaseOrders")
Set wsDest = Workbooks("LineItemsReportGraph.xlsm").Worksheets("Purchase Orders")

'1. Find last used row in the copy range based on data in column A
lCopyLastRow = wsCopy.Cells(wsCopy.Rows.Count, "A").End(xlUp).Row

'2. Find first blank row in the destination range based on data in column A
'Offset property moves down 1 row
lDestLastRow = wsDest.Cells(wsDest.Rows.Count, "A").End(xlUp).Offset(1).Row

'3. Clear contents of existing data range
wsDest.Range("A1:K" & lDestLastRow).ClearContents

'4. Copy & Paste Data
wsCopy.Range("A1:K" & lCopyLastRow).Copy _
wsDest.Range("A1")


Workbooks("PurchaseOrders.csv").Close SaveChanges:=True
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
See if what I put in the edit in the last post about additional settings is true. If it is then I am afraid that I am out of ideas without seeing the wsCopy workbook.
If you can upload a copy to a free file hosting site like www.box.com or www.dropbox.com, mark it for sharing and post the link it supplies in the thread.
Make sure that you amend any sensitive information before uploading.
 
Upvote 0
Sorry, can you also post your full code (in code tags) after making the changes that I stated in post #4 so that I can check it.
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,244
Members
452,622
Latest member
Laura_PinksBTHFT

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top