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

I am having some problems with this code. This is part of a macro.

This part is working fine
ActiveCell.FormulaR1C1 = "=SUM(RC[" & -Sheets.Count & "]:RC[-2])"
But I want to include this part
-(Cells(11, Sheets.Count + 1))
Thus having
ActiveCell.FormulaR1C1 = "=SUM(RC[" & -Sheets.Count & "]:RC[-2])-" &
(Cells(11, Sheets.Count + 1))
This way it does not work. It gives me an error, and I can understand why.

Another problem is that the result of the following code is:
ActiveCell.FormulaR1C1 = "=SUM(" & Sheets(1).Name & ":" &
Sheets(Sheets.Count).Name & "!e11)"
=SUM(tps1:tps26!e11)
The expression e11 appears between €˜. I need to remove this €˜, but dont
know who.

Any help is most welcome.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default formula error

The first one works fine for me as long as that cell contains a number.

Second

ActiveCell.Formula = "=SUM(" & Sheets(1).Name & ":" &
Sheets(Sheets.Count).Name & "!E11)"


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Raul Sousa" wrote in message
...
I am having some problems with this code. This is part of a macro.

This part is working fine
ActiveCell.FormulaR1C1 = "=SUM(RC[" & -Sheets.Count & "]:RC[-2])"
But I want to include this part
-(Cells(11, Sheets.Count + 1))
Thus having
ActiveCell.FormulaR1C1 = "=SUM(RC[" & -Sheets.Count & "]:RC[-2])-" &
(Cells(11, Sheets.Count + 1))
This way it does not work. It gives me an error, and I can understand why.

Another problem is that the result of the following code is:
ActiveCell.FormulaR1C1 = "=SUM(" & Sheets(1).Name & ":" &
Sheets(Sheets.Count).Name & "!e11)"
=SUM(tps1:tps26!'e11')
The expression e11 appears between ''. I need to remove this '', but don't
know who.

Any help is most welcome.



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
IF formula returns error; abbreviating the formula MZ Excel Discussion (Misc queries) 4 January 7th 10 11:02 PM
Formula Error-Error Message Paige Excel Programming 2 July 25th 06 09:11 PM
Formula expected end of statement error, typing formula into cell as part of VBA macro [email protected] Excel Programming 1 July 20th 06 07:58 PM
How do I replace "#N/A" error, to continue my formula w/o error? Ali Khan Excel Worksheet Functions 2 February 20th 06 03:49 PM
Formula error with Mac resulting in '#NAME' error Linking to specific cells in pivot table Excel Programming 2 August 1st 05 07:13 AM


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