excel - Copying an array is swapping days/months in (seemingly) random cells -


I am very new to VBA (e.g., about 2 weeks).

I is defining an array in a sheet and then making it another moving copy (which after this I want to do with it, this code is just to check that it is Works properly).

, my array is copied, but many (seemingly random) cells are switched around day / month in E.G. 06/01/1984 has been 01/06/1984

This code is:

  Sub Defined_Areaz () Dim Wsh Worksheet Demet FTSE 100 (1 to 1592 , 1 to 5) String dim row_A integer dim column_A integer as defined as' FTSE 100 array row_A = Set for LBound (FTSE100, WSH = Sheet2 Wsh.Activate row_A = 1 column_A = 1 1) To do UBound (FTSE100, 1) for column_A = LBound (FTSE100, 2) UBound (FTSE100, 2) = FTSE100 (row_A, column_A) = cells (row_A, column_A) Next column_A Next row_A 'print FTSE Set 100 array WSH = sheet1 Wsh.Activ Ate row_A = LBound (for FTSE100, 1) UBound (FTSE100, 1) column_A = LBound (for FTSE100, 2) UBound (FTSE100, 2) cells (row_A, column_A) = FTSE100 (row_A, column_A) Next column_A next row_A End Sub  

The original array looks like this

  Date (GMT) Open High Low Last 06/01/1984 997.5 1029.3 993.3 1029 13/01/1984 1034.6 1042.7 1020.2 1042.7 20/01 / 1984 1046 1060.6 1036.2 1059 27/01/1984 1046.8 1075.9 1039.9 1075.9 03/02/1984 1068.6 1082 1046 1059.8 10/02/1984 1038.2 1054.2 1010 1018  

and the output looks like this

  Date (GMT) Open High Low Last 01/06/1984 997,5 1029,3 993,3 1029 13/01 / 1984 1034,6 1042,7 1020.2 1042,7 20/01/1984 1046 1060, 6 1036,2 1059 27/01/1984 1046,81075,91039,91075,9 02/03/1984 1068,61082 1046 1059.8 02/10/1984 1038.2 1054.2 1010 1018  

I cleared date formatting for both columns and found the following:

Original:

  Date (GMT) Open High Low Last 30687 997.5 1029,3 993,3 1029 30694 1034,6 1042,7 1020,2 1042,7 30701 1046 1060,6 1036,2 1059 30708 1046,8 1075,9 1039,9 1075,9 30715 1068,6 1082 1046 1059, Output:  
  Date (GMT) Open High Low Last 30834 997.5 1029.3 993.3 1029 13/01 / 1984 1034.6 1042.7 1020.2 1042,7 20/01/1984 1046 1060,6 1036,2 1059 27/01/1984 1046,81075,91039,91075,930743 1068,61082 1046 1059.8 30957 1038 , 2 1054,201 1018  

The interesting thing is that when I run the code with the cells date is not formatted, it works perfectly well. Any suggestion about whatever is going wrong will be highly appreciated.

Posting as reply to the request:

  array (x, y) = format (cells (x, y), "mm / dd / yyyy")  

enter the correct value for this date , Then it should be output in any date format according to the use of your workbook.


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -