Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / January 2008

Tip: Looking for answers? Try searching our database.

error msg in function  .... any ideas????

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Kelvin - 09 Jan 2008 10:31 GMT
Sub RIRthreedates()                                    
    Range("m3").Formula = "=IF(count(i3:k3)<3,"",if(i3>j3,i3,if(j3>k3,
j3,k3)))" End Sub

This subR causes a runtime error " application defined or object defined
error" 1004
If I put the formula in the cell  directly , it works fine.

if I use the equation     Range("m2").Formula = "=counta(a3:a5)"    in the
subR
it works fine.

why would the above line cause this error.  Can someone shed some light????

thanks

Signature

KWB

Pete_UK - 09 Jan 2008 10:58 GMT
Put the EndSub on a separate line.

Pete

> Sub RIRthreedates()                                    
>      Range("m3").Formula = "=IF(count(i3:k3)<3,"",if(i3>j3,i3,if(j3>k3,
[quoted text clipped - 14 lines]
> --
> KWB
Dave Peterson - 09 Jan 2008 14:48 GMT
You have to double up the double quotes in the string:

Sub RIRthreedates()                                    
    Range("m3").Formula _
      = "=IF(count(i3:k3)<3,"""",if(i3>j3,i3,if(j3>k3,j3,k3)))"
End Sub

> Sub RIRthreedates()
>      Range("m3").Formula = "=IF(count(i3:k3)<3,"",if(i3>j3,i3,if(j3>k3,
[quoted text clipped - 14 lines]
> --
> KWB

Signature

Dave Peterson

Kelvin - 09 Jan 2008 16:43 GMT
Dave,

Thanks for the tip.  The doubling up on the  quotes worked.

Could you enlighten me as to why the four quotes are neccessary?

Thanks to all for your input.

Signature

KWB

> You have to double up the double quotes in the string:
>
[quoted text clipped - 21 lines]
> > --
> > KWB
JP - 09 Jan 2008 17:11 GMT
When you actually want quotes to appear, you have to, put them in
quotes. :-)

HTH,
JP

> Dave,
>
[quoted text clipped - 6 lines]
> --
> KWB
Kelvin - 09 Jan 2008 18:26 GMT
JP,
Actually what I was looking for, and what actually happens is that the ""
gives me a blank cell if the condition is not met.

I wasn't sure why I would need the quotes around my quotes for this?

Signature

KWB

> When you actually want quotes to appear, you have to, put them in
> quotes. :-)
[quoted text clipped - 12 lines]
> > --
> > KWB
Tyro - 09 Jan 2008 17:17 GMT
In Visual Basic text begins and ends with quotes. To express "", you must
put quotes around it. Thus """".

Tyro

> Dave,
>
[quoted text clipped - 32 lines]
>> > --
>> > KWB
Kelvin - 11 Jan 2008 06:37 GMT
Thanks to all   for the information.

Greatly appreciated.

Kelvin
Signature

KWB

> In Visual Basic text begins and ends with quotes. To express "", you must
> put quotes around it. Thus """".
[quoted text clipped - 37 lines]
> >> > --
> >> > KWB
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.