• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

new at VBA copy macro defined by date problem.

Vulture

New Member
Hello all, I am new to macro's and would appreciate help, I have an issue with a macro that I need to copy data between 2 workbooks. One of the criteara is that only the previous months data needs copying across. Whatever the day the update occurs only the last full month i.e. (Sept) should be used this is vital. The second criteara is when the data is copied across it is enterd on the next empty row in the destination file. My source sheet is named 4x4, and the destination file is named D & T Totals. Is it possible to make this and automatic update on the first day of the next month or when the next time the destination file is opened. The custom date (dddd, mmm dd, yyyy) is in column "A"
Any help would be apperiated.
Thanks
 
Thanks Nebu for replying to me, I have attached a sample file. This macro is all centred around column "A".

Edit by moderator: removed attachment as per OP's request.
 
Last edited by a moderator:
Hi:

You are talking about 2 files source file and destination file. I need both the files to code and test. The macro can be triggered automatically once the destination file is opened.Could you upload the both the files and identify which one in source and which one is destination.

Note: Your files are password protected , remove the protection as well.

Thanks
 
Hi:

You are talking about 2 files source file and destination file. I need both the files to code and test. The macro can be triggered automatically once the destination file is opened.Could you upload the both the files and identify which one in source and which one is destination.

Note: Your files are password protected , remove the protection as well.

Thanks

Here are the files with the PWD removed
 
Hi:

I had to delete some blank rows in your D&T workbook to get the last row number. You should not insert any blank rows in your D&T work book else the count will go off. I also had to insert dummy headers in your macro test file to get the SQL to work.

Note :In VBE tools reference add the following library before running the code
Microsoft ActiveX Data Objects 6.1


Thanks
 

Attachments

  • D&T Totals.xlsm
    66.5 KB · Views: 3
  • macroTest.xlsx
    10.5 KB · Views: 2
Hi:

I had to delete some blank rows in your D&T workbook to get the last row number. You should not insert any blank rows in your D&T work book else the count will go off. I also had to insert dummy headers in your macro test file to get the SQL to work.

Note :In VBE tools reference add the following library before running the code
Microsoft ActiveX Data Objects 6.1


Thanks
Hi:

I had to delete some blank rows in your D&T workbook to get the last row number. You should not insert any blank rows in your D&T work book else the count will go off. I also had to insert dummy headers in your macro test file to get the SQL to work.

Note :In VBE tools reference add the following library before running the code
Microsoft ActiveX Data Objects 6.1


Thanks


Nebu I tried to run this macro but after editing the source file name to the correct file i got this error msg.
 

Attachments

  • error msg.docx
    151.7 KB · Views: 1
Hi:

As I asked in my previous post you have not added the library in your workbook.

Note :In VBE tools reference add the following library before running the code
Microsoft ActiveX Data Objects 6.1

Thanks
 
Back
Top