ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel 2002 and VB Macro (https://www.excelbanter.com/excel-programming/329087-excel-2002-vbulletin-macro.html)

adavisRSC

Excel 2002 and VB Macro
 
I'm trying to insert an Excel IF formula into cells where the logical test is
based on employee names. If the name is found, it returns the employee's
hourly rate, if not zero. Here is what I've done:

Do Until IsEmpty(ActiveCell.Offset(0, -11))
ActiveCell.FormulaR1C1 = "=IF(+RC[-5]="Smith, Joe",11,0)"
ActiveCell.Offset(1, 0).Select
Loop

The problem is too many "s. I need to include the formula in "" and the
string in "", but VB expects the first " of the string to be the end of the
argument.

How can I handle this?

Thanks

Vasant Nanavati

Excel 2002 and VB Macro
 
ActiveCell.FormulaR1C1 = "=IF(RC[-5]= ""Smith, Joe"" ,11,0)"

--

Vasant

"adavisRSC" wrote in message
...
I'm trying to insert an Excel IF formula into cells where the logical test

is
based on employee names. If the name is found, it returns the employee's
hourly rate, if not zero. Here is what I've done:

Do Until IsEmpty(ActiveCell.Offset(0, -11))
ActiveCell.FormulaR1C1 = "=IF(+RC[-5]="Smith, Joe",11,0)"
ActiveCell.Offset(1, 0).Select
Loop

The problem is too many "s. I need to include the formula in "" and the
string in "", but VB expects the first " of the string to be the end of

the
argument.

How can I handle this?

Thanks





All times are GMT +1. The time now is 03:06 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com