Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Working with quotes

In a conditional statement, I need to code a formula that
contains quotes. I am having problems. How should I
code the following?

If Dues < 0# Then
Worksheets("Settlement").Range("I35").Value = Dues
Else
Worksheets("Settlement").Range("I35").Value = _
=IF(N39="W",ROUND(H39*$H$27,2),IF(N39="G",ROUND
(H39*$C$27,2),ROUND(H39*$F$27,2)))
End If

Thanks
Mike
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 550
Default Working with quotes

Squid,

Worksheets("Settlement").Range("I35").Value = _
"=IF(N39=""W"",ROUND(H39*$H$27,2),IF(N39=""G"",ROU ND
(H39*$C$27,2),ROUND(H39*$F$27,2)))"

John


"Squid" wrote in message
...
In a conditional statement, I need to code a formula that
contains quotes. I am having problems. How should I
code the following?

If Dues < 0# Then
Worksheets("Settlement").Range("I35").Value = Dues
Else
Worksheets("Settlement").Range("I35").Value = _
=IF(N39="W",ROUND(H39*$H$27,2),IF(N39="G",ROUND
(H39*$C$27,2),ROUND(H39*$F$27,2)))
End If

Thanks
Mike



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Working with quotes

I think I figured it out..

"=IF(N35=" & Chr(34) & "W" & Chr(34) & ",ROUND
(H35*$H$27,2),IF(N35=" & Chr(34) & "G" & Chr(34) & ",ROUND
(H35*$C$27,2),ROUND(H35*$F$27,2)))"


-----Original Message-----
In a conditional statement, I need to code a formula

that
contains quotes. I am having problems. How should I
code the following?

If Dues < 0# Then
Worksheets("Settlement").Range("I35").Value = Dues
Else
Worksheets("Settlement").Range("I35").Value = _
=IF(N39="W",ROUND(H39*$H$27,2),IF(N39="G",ROUND
(H39*$C$27,2),ROUND(H39*$F$27,2)))
End If

Thanks
Mike
.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 550
Default Working with quotes

Squid,

That'll work too, but it's easier just doubling up the quotes like I showed
you in my post.

John

"Squid" wrote in message
...
I think I figured it out..

"=IF(N35=" & Chr(34) & "W" & Chr(34) & ",ROUND
(H35*$H$27,2),IF(N35=" & Chr(34) & "G" & Chr(34) & ",ROUND
(H35*$C$27,2),ROUND(H35*$F$27,2)))"


-----Original Message-----
In a conditional statement, I need to code a formula

that
contains quotes. I am having problems. How should I
code the following?

If Dues < 0# Then
Worksheets("Settlement").Range("I35").Value = Dues
Else
Worksheets("Settlement").Range("I35").Value = _
=IF(N39="W",ROUND(H39*$H$27,2),IF(N39="G",ROUND
(H39*$C$27,2),ROUND(H39*$F$27,2)))
End If

Thanks
Mike
.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Working with quotes

And from a tip from Tom Ogilvy:

Option Explicit
Sub testme01()

Dim Dues As Double
Dim myStr As String
Dues = 0

If Dues < 0# Then
Worksheets("Settlement").Range("I35").Value = Dues
Else
myStr = "=IF(N39=@W@,ROUND(H39*$H$27,2)," _
& "IF(N39=@G@,ROUND(H39*$C$27,2),ROUND(H39*$F$27,2)) )"

myStr = Application.Substitute(myStr, "@", Chr(34))

Worksheets("Settlement").Range("I35").Formula = myStr

End If

End Sub

It might be overkill here, but when you have lots of those """"'s...




Squid wrote:

In a conditional statement, I need to code a formula that
contains quotes. I am having problems. How should I
code the following?

If Dues < 0# Then
Worksheets("Settlement").Range("I35").Value = Dues
Else
Worksheets("Settlement").Range("I35").Value = _
=IF(N39="W",ROUND(H39*$H$27,2),IF(N39="G",ROUND
(H39*$C$27,2),ROUND(H39*$F$27,2)))
End If

Thanks
Mike


--

Dave Peterson



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
MSN Stock Quotes not working tom_k Excel Worksheet Functions 0 December 22nd 09 02:19 AM
change straight quotes to curly quotes callico Excel Discussion (Misc queries) 2 June 22nd 07 10:23 PM
Yahoo historical quotes quit working with web query Roy Excel Discussion (Misc queries) 0 July 22nd 06 10:30 PM
How do i get historical stock quotes using MSN Money Stock Quotes Ash Excel Discussion (Misc queries) 0 May 11th 06 03:26 AM
Using CSV and quotes Neil Excel Discussion (Misc queries) 4 October 31st 05 07:59 PM


All times are GMT +1. The time now is 11:02 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"