VBA code to copy and paste between sheets based on the selection criteria being a date

mps80y

New Member
Joined
Apr 3, 2019
Messages
21
Hi All,

I have a spreadsheet that has several sheets;

Sheet 'Calc_Sheet' contains a value in cell E1 which lists the last date of the previous month in the format dd/mm/yyyy and is formatted as a Date field - *dd/mm/yyyy.

I have another sheet 'Previous Month' that has all the data of bookings made. Column C in that sheet also has a date in the format dd/mm/yyyy and is also formatted as a Date field - *dd/mm/yyyy

I need to copy all the rows from the 'Previous Month' sheet, that match the date in cell E1 in sheet 'Calc_Sheet' and copy them to the end of a third sheet 'Current Month'.

Another member has helped with the code and its working fine if my computers regional settings are configured to mm/dd/yyyy but the code doesn't work if i change my regional settings back to dd/mm/yyyy (as I'm Australian based).

Any suggestions on how to get around this?

A link to the file is here

TIA :)
 

mps80y

New Member
Joined
Apr 3, 2019
Messages
21
It appears that the issue is with the way cDate handles the date - it only recognises the format mm-dd-yyyy, anyone have any ideas on how to change it to accept dd-mm-yyyy

Revised file is here
 

Forum statistics

Threads
1,081,795
Messages
5,361,333
Members
400,627
Latest member
Mcomeaux

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top