Vba - Problem with Format (X,X)

vadius

Board Regular
Joined
Jul 5, 2011
Messages
70
Hi all,

I have a problem with the Format & CDate function.
I got the error "Wrong number of arguments or invalid property assignment" and I don't understand why. Each time I want to Format with a "F", it automatically puts it with a "f" also.. Before it was working and now I have the erroe message.

Has anyone an idea why I got this problem ?

Thanks

On the sheet "SPIExtractfinal", in each first cell of every 233th row, I have the text "SPI® TR as of 01-07-2010" and I want the macro to get me the date. On Each 233th row is a different date..

Code:
Sub SPIpricecopydate()
Dim strValue As String
Dim strCellNum As String
Dim cleandate As String
Dim x As String
x = 2

For i = 2 To 58951 Step 233
    strCellNum = "A" & i
    strValue = Worksheets("SPIExtractfinal").Range(strCellNum).Value
    Debug.Print strValue
    Worksheets("SPICleanprice").Range("A" & x).Value = format(CDate(Right(strValue, 10)), "dd/mmm/yy")
    
    x = x + 1
Next
End Sub
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN

Forum statistics

Threads
1,224,527
Messages
6,179,334
Members
452,907
Latest member
Roland Deschain

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