Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 79
Default Line in Macro doesn't work.

The following line in my macro won't work:

ActiveCell.FormulaR1C1 = "=IF(ISERROR(SEARCH(" -
",(RC[-7]))),(RC[-7]),-SUBSTITUTE((RC[-7])," - ",""))"

I have used the ActiveCell.Formula before but on little formulas. I want it
to write a formula in a cell that looks at a cell 7 columns to the left and
determine if it is text or not (imported data from SAP) and if it is text, I
want it to remove the "-" and put as a negative number.

I'm not very knowledgeable about VBA or macros. What I know is from what
I've copied from other recorded macros and pieced together.

Thanks for the help!!


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Line in Macro doesn't work.

ActiveCell.FormulaR1C1 = "=IF(ISERROR(SEARCH("" - ""," & _
"(RC[-7]))),(RC[-7])," & _
"-SUBSTITUTE((RC[-7]),"" - "",""""))"

when you have embedded quotes, you need to double-up.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Valerie" wrote in message
...
The following line in my macro won't work:

ActiveCell.FormulaR1C1 = "=IF(ISERROR(SEARCH(" -
",(RC[-7]))),(RC[-7]),-SUBSTITUTE((RC[-7])," - ",""))"

I have used the ActiveCell.Formula before but on little formulas. I want

it
to write a formula in a cell that looks at a cell 7 columns to the left

and
determine if it is text or not (imported data from SAP) and if it is text,

I
want it to remove the "-" and put as a negative number.

I'm not very knowledgeable about VBA or macros. What I know is from what
I've copied from other recorded macros and pieced together.

Thanks for the help!!




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 79
Default Line in Macro doesn't work.

Thanks so much!!
V

"Bob Phillips" wrote:

ActiveCell.FormulaR1C1 = "=IF(ISERROR(SEARCH("" - ""," & _
"(RC[-7]))),(RC[-7])," & _
"-SUBSTITUTE((RC[-7]),"" - "",""""))"

when you have embedded quotes, you need to double-up.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Valerie" wrote in message
...
The following line in my macro won't work:

ActiveCell.FormulaR1C1 = "=IF(ISERROR(SEARCH(" -
",(RC[-7]))),(RC[-7]),-SUBSTITUTE((RC[-7])," - ",""))"

I have used the ActiveCell.Formula before but on little formulas. I want

it
to write a formula in a cell that looks at a cell 7 columns to the left

and
determine if it is text or not (imported data from SAP) and if it is text,

I
want it to remove the "-" and put as a negative number.

I'm not very knowledgeable about VBA or macros. What I know is from what
I've copied from other recorded macros and pieced together.

Thanks for the help!!





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
Macro code to put series name next to individual line in line grap Otani Charts and Charting in Excel 3 February 23rd 10 07:24 PM
Macro to update a column in a work based on another work sheet WickerMan New Users to Excel 1 December 4th 09 12:58 PM
How do I get a line break to always work? AFD at FONO[_2_] Excel Discussion (Misc queries) 2 May 15th 08 12:29 AM
Macro problem on, Yellowed line - previous line or next line. Ed Excel Programming 7 March 29th 05 09:37 PM
Macro convert CSV -to- XLS without parsing line by line BHARATH RAJAMANI Excel Programming 5 September 17th 04 04:45 PM


All times are GMT +1. The time now is 06:35 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"