Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
Please explain what is wrong with this: Dim sMonth as string smonth = format(Sheets("ChartsP").Range("a1").Value, "mmm-yy") I am getting an error message: "Wrong number of arguments or invalid property assignment TIA Dave |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The line looks OK. Is that all you have..Where is this code placed?
If this post helps click Yes --------------- Jacob Skaria "Risky Dave" wrote: Hi, Please explain what is wrong with this: Dim sMonth as string smonth = format(Sheets("ChartsP").Range("a1").Value, "mmm-yy") I am getting an error message: "Wrong number of arguments or invalid property assignment TIA Dave |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Jacob,
Thanks for the quick reply. This is the start of the code (the whole things is about 80 lines, so I won't post it all here): Dim sMonth As String Dim sLastEntry As String Dim lNetScore As Long Dim arrSum As Variant Dim lriskcount As Long Dim lRowNum As Long Application.ScreenUpdating = False ' check if it is the same month Set rCurrentCell = Sheets("ChartsP").Range("n2") Do Set rCurrentCell = rCurrentCell.Offset(1, 0) Loop Until rCurrentCell.Value = "" Set rCurrentCell = rCurrentCell.Offset(-1, 0) sMonth = Sheets("ChartsP").Range("a1").Value Do sLastEntry = rCurrentCell.Value If sMonth = sLastEntry Then ' do stuff here Loop Application.ScreenUpdating = True End Sub What I am trying to do is read the value of a specified cell that contains Today() and format it as "mmm-yy" to a string variable (sMonth). Then I want to compare sMonth with another string variable (sLastEntry) which gets it content from a different cell and is formatted in the same way. Hope this makes sense Dave "Jacob Skaria" wrote: The line looks OK. Is that all you have..Where is this code placed? If this post helps click Yes --------------- Jacob Skaria "Risky Dave" wrote: Hi, Please explain what is wrong with this: Dim sMonth as string smonth = format(Sheets("ChartsP").Range("a1").Value, "mmm-yy") I am getting an error message: "Wrong number of arguments or invalid property assignment TIA Dave |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You dont need to loop if you are trying to get the last entry in Col N
'Try (if both cells are in excel date format) If Sheets("ChartsP").Cells(Rows.Count, "N").End(xlUp).Value = _ Sheets("ChartsP").Range("a1").Value Then End If If this post helps click Yes --------------- Jacob Skaria "Risky Dave" wrote: Jacob, Thanks for the quick reply. This is the start of the code (the whole things is about 80 lines, so I won't post it all here): Dim sMonth As String Dim sLastEntry As String Dim lNetScore As Long Dim arrSum As Variant Dim lriskcount As Long Dim lRowNum As Long Application.ScreenUpdating = False ' check if it is the same month Set rCurrentCell = Sheets("ChartsP").Range("n2") Do Set rCurrentCell = rCurrentCell.Offset(1, 0) Loop Until rCurrentCell.Value = "" Set rCurrentCell = rCurrentCell.Offset(-1, 0) sMonth = Sheets("ChartsP").Range("a1").Value Do sLastEntry = rCurrentCell.Value If sMonth = sLastEntry Then ' do stuff here Loop Application.ScreenUpdating = True End Sub What I am trying to do is read the value of a specified cell that contains Today() and format it as "mmm-yy" to a string variable (sMonth). Then I want to compare sMonth with another string variable (sLastEntry) which gets it content from a different cell and is formatted in the same way. Hope this makes sense Dave "Jacob Skaria" wrote: The line looks OK. Is that all you have..Where is this code placed? If this post helps click Yes --------------- Jacob Skaria "Risky Dave" wrote: Hi, Please explain what is wrong with this: Dim sMonth as string smonth = format(Sheets("ChartsP").Range("a1").Value, "mmm-yy") I am getting an error message: "Wrong number of arguments or invalid property assignment TIA Dave |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
permanent conversion of 1904 date format to 1900 date format | Excel Worksheet Functions | |||
convert serial date format to normal date format | Excel Discussion (Misc queries) | |||
Excel 2000 date format cannot be set to Australian date format | Excel Discussion (Misc queries) | |||
code to convert date from TEXT format (03-02) to DATE format (200203) | Excel Programming | |||
Change a date in text format xx.xx.20xx to a recognised date format | Excel Programming |