Hello,
I want to record the values of income and their respective month and day values into 3 arrays, i.e. income(), income_m() and income_d(). But there is an error message of "mismatching". I don't know what it means exactly and would like to seek your help.
-----------------------------
Col B: date (in the format of YYYY/MM/DD)
Col D: amount of income
The outlook of my worksheet looks like this ( only col B and D are displayed below )
<tbody>
</tbody>
My code:
Thanks!
I want to record the values of income and their respective month and day values into 3 arrays, i.e. income(), income_m() and income_d(). But there is an error message of "mismatching". I don't know what it means exactly and would like to seek your help.
-----------------------------
Col B: date (in the format of YYYY/MM/DD)
Col D: amount of income
The outlook of my worksheet looks like this ( only col B and D are displayed below )
B | D | |
1 | Date | Income |
2 | 2015/1/14 | |
3 | 2015/2/23 | |
4 | 2015/3/17 | 10,000 |
5 | 2015/4/23 | 20,000 |
6 | 2015/5/29 | 15,000 |
<tbody>
</tbody>
My code:
Code:
If Application.WorksheetFunction.CountA(Range("D:D")) > 1 Then
i = Range("D1").End(xlDown).Row
j = 1
Do While i <> Rows.Count + 1
[COLOR=#ff0000] income(j) = Range("D" & i).Value ' <--- Error Here, but why?[/COLOR]
income_m(j) = Month(Range("D" & i).Offset(0, -2).Value)
income_d(j) = Day(Range("D" & i).Offset(0, -2).Value)
i = i + 1
j = j + 1
Loop
End If
Thanks!
Last edited: