Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Adding formula to a cell with VB


Hi

I need to add a formula to a cell ( actually a range of cells) uing
VB.

The formula is

=IF($U6="","",IF(OR($T6="Yes",$U6="Yes"),"HICA",IF ($E6="No
Notice","CALL","Notice")))

I would like to use something like:

Range("V2").Formula = "=IF(OR(T2="Yes",U2="Yes"),"HICA",IF(E2="No
Notice","CALL","Notice"))"


My problem is that the quotes in the formula are read as the end of the
string in the vb. Could anyone help please?

Thanks


--
Willow
------------------------------------------------------------------------
Willow's Profile: http://www.excelforum.com/member.php...o&userid=16070
View this thread: http://www.excelforum.com/showthread...hreadid=564642

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Adding formula to a cell with VB


You need to use double (double double!) quotes:

Range("V2").Formula =
"=IF(OR(T2=""Yes"",U2=""Yes""),""HICA"",IF(E2= ""No
Notice"",""CALL"",""Notice""))"


--
lucidr
------------------------------------------------------------------------
lucidr's Profile: http://www.excelforum.com/member.php...o&userid=36699
View this thread: http://www.excelforum.com/showthread...hreadid=564642

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Adding formula to a cell with VB


Thanks - I knew it was something simple.


--
Willow
------------------------------------------------------------------------
Willow's Profile: http://www.excelforum.com/member.php...o&userid=16070
View this thread: http://www.excelforum.com/showthread...hreadid=564642

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default Adding formula to a cell with VB


Willow,

The easiest way to get this right is to turn on the recorder and then
enter the formula into the cell.

Kind regards,
NickH

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default Adding formula to a cell with VB


Willow,

The easiest way to get this right is to turn on the recorder and then
enter the formula into the cell.

Kind regards,
NickH



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
adding a formula around a cell reference Greek77 Excel Discussion (Misc queries) 4 May 17th 07 10:32 PM
Adding Contents of a cell to a formula Paul Bond Excel Discussion (Misc queries) 10 January 25th 06 04:43 PM
formula for adding every other cell in Excel Michelle Odell Excel Worksheet Functions 2 January 23rd 06 05:30 PM
adding a formula in a cell but when cell = 0 cell is blank Mike T Excel Worksheet Functions 5 May 31st 05 01:08 AM
Adding new sheet's cell value to old formula Eric Silva Excel Programming 4 January 5th 05 07:10 PM


All times are GMT +1. The time now is 10:34 PM.

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"