Type Mismatch in an Array dimmed as Date

arindampaul

New Member
Joined
Nov 29, 2013
Messages
1
Hi,

I was trying to sort out and make a consolidated table from a big data file of size around 18 MB. In this data file, I have to take out the dates from one sheet and paste on other sheet. So, I created one array named Dates() and dimmed it as Date. (For your information, I have to do this in such a way where each element of this array is being recognised as date, otherwise it was being changed to USA format and giving wrong result.) I made it a single element array to use less memory. Now I am using the following code:

For i = 1 To m
Dates(1) = Mid(Worksheets(1).Cells(7 + 3 * i + 15 * (k - 1), 1), 2, 8)
Worksheets(2).Cells(i + 4, 2) = Dates(1)
If 3 * i = 45 * k Then
k = k + 1
End If
Next i

In my code, m = 200,000. At i = 1086, it is showing as 'data mismatch'. But when I checked the cell it was currently working on viz. cell with row number 4330, it was showing a date only. But it did not recognise.

Can anyone please help me out to resolve the problem?
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!

Forum statistics

Threads
1,214,431
Messages
6,119,457
Members
448,898
Latest member
drewmorgan128

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