Month Function- Compile error Wrong number of arguments or invalid property assignment

adr12345

Board Regular
Joined
Jan 19, 2015
Messages
67
Hi


Below is a piece of code which is giving me error "Compile error Wrong number of arguments or invalid property assignment"
This is not the complete code, however at every month function I am getting this error.
Need help on this !!!


count = Range("A1", Range("A1").End(xlDown)).count

Range("A1").End(xlToRight).Offset(0, 1).Select
ActiveCell.Value = "Month-Year"
ActiveCell.Offset(1, 0).Select
i = 2
While i <= count
Dim res2 As Variant
On Error Resume Next

res2 = Month(Cells(i, Application.WorksheetFunction.Match("Completed On", Rows(1), 0))) & "-" & Year(Cells(i, Application.WorksheetFunction.Match("Completed On", Rows(1), 0)))
If res2 = "" Then
ActiveCell.Value = ""
Else: ActiveCell.Value = Month(Cells(i, Application.WorksheetFunction.Match("Completed On", Rows(1), 0))) & "-" & Year(Cells(i, Application.WorksheetFunction.Match("Completed On", Rows(1), 0)))
End If
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Do you have a function/subroutine called Month, or a variable by that name?
 
Upvote 0
There must be something - there is no error with the function code as posted. Can you post the complete code?
 
Upvote 0

Forum statistics

Threads
1,223,270
Messages
6,171,102
Members
452,379
Latest member
IainTru

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