PDA

View Full Version : Wrong number of arguments or invalid property assignment



tqm1
06-15-2007, 07:17 AM
Dear Experts

Following procedure was working fine. But today it has started to display this compiler error message

Wrong number of arguments or invalid property assignment

What is wrong?


Private Sub UserForm_Initialize()
Dim iLastRow As Long

With Sheets("weights")
iLastRow = .Range("B" & .Rows.Count).End(xlUp).Row

If iLastRow > 1 Then
TextBox2.Value = Format(.Cells(iLastRow, "L"), "dd-mm-yy") ' this line show error
icurRow = iLastRow
End If
End With
Ens Sub

Bob Phillips
06-15-2007, 07:38 AM
Add this line before the offending line



MsgBox .Cells(iLastRow, "L").Text


and let's see.

tqm1
06-15-2007, 05:56 PM
Dear Sir,



MsgBox .Cells(iLastRow, "L").Text

Msgbox shows=01-05-07
If I Write codes as


TextBox2.Value = .Cells(iLastRow, "L")

then textbox2.value is =01/05/2007
But I want to dispaly it with following format
01-05-07

Please help

Bob Phillips
06-16-2007, 01:57 AM
It's amazing how you shift the problem. This started as an error, and ends as a format ?



TextBox2.Value = Format(.Cells(iLastRow, "L").Value, "dd-mm-yy")

tqm1
06-16-2007, 04:35 AM
Dear Sir,

I refer to another link for more understanding

http://www.excelforum.com/showthread.php?t=603819

Please review

johnske
06-16-2007, 06:38 AM
ANOTHER cross-post? And you only give the link in post #5? This is a really good way to get yourself banned from every board on the planet tqm1. In fact I'm seriously considering banning you from this one right now...

Bob Phillips
06-16-2007, 07:05 AM
And that one is different again. You're too much like hard work, I'll think I'll personally ignore your posts now.

johnske
06-16-2007, 07:12 AM
tqm1,

I have placed a temporary ban on your posting at VBAX.

This ban is for repeated cross-posting and will be in effect for 48 hours. If you wish to appeal against this decision, feel free to PM me or any other administrator.

Have a nice day,
John

tqm1
06-18-2007, 06:56 AM
Thank you very much for sending me jail.