vba - Excel changes dates where the day is lower than the month (e.g 2nd april) to the reverse (e.g 4th feb) -


I have some tables with Excel and dates. The situation is as follows: We have monthly reports with many tabs, which import macros in the central spreadsheet, there are about 120 columns in it. After importing, I have to add some formulas to some last columns relevant to the data, but are not included in the data, and one of these is the duration (we start from April 1 and April 13 for the customer Working for the customer, 4 weeks duration in the year) To accomplish this, I have a separate sheet with all the dates in column A., after that period and other columns in the following column. A simple Vlookup looks at the date and gives the duration.

However, some dates are stored in the form of text (and therefore vlookup # N / A), ordinary fix, paste special - Add spaces, cell and wola, and if it does If it does manually it works. But that means all the work is done for the user, so I tried to program it according to the code given below:

  'Sheets ("dates and duration"). Activate range '(range' (cells 2, 5), cell (last, 5)) Paste special XLPist value, XL paste special operation aid range (cell (2, 5), cell (Letro, 5)) No.format = "DD / MM / Yay"  

I get the empty cell "dates and duration" because I know that it will definitely be empty

Now when I run this code, it works for most values, though all in column E For the people, where the day is smaller than the month, like April 1st, May 4, etc., it switches around day and month, and it is not formatting, by changing the long date I can see that it has changed data Around this?

Is there a way around this? I have looked towards a solution, but when I searched, all the problems had to be done with the date system or formatting 1904.

Any help would be appreciated.

Even Function: cells (cells, 2, 5), cells (last, 5)) for each cell in the range

  by breaking it into pieces and putting it back together. Value = Mid (cell, 4, 2) & amp; "/" & Amp; Left (cell, 2) & amp; "/" & Amp; Right (Cell, 4) Next cell  

I have had this problem several times Typically the solution is specific, but you can try to convert the date into a string in the DD-MMM-yyyy format, then again again.


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -