Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default implement test="=(SUM(R[-181]C:R[-170]C)-string1)/string2 "inVBA?

How do I implement: test="=(SUM(R[-181]C:R[-170]C)-string1)/string2 "in excel
VBA ?

Seems like VBA understands test="=SUM(R[-181]C:R[-170]C)-string1 but not
when dividing by one more string

HELP
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default implement test="=(SUM(R[-181]C:R[-170]C)-string1)/string2 "inVBA?

I think you would get a better answer if you gave a specific example that
works and a specific example that does not work. Also, once assigned to the
variable "test", what do you intend to do with "test".

--
Regards,
Tom Ogilvy


"Monika" wrote:

How do I implement: test="=(SUM(R[-181]C:R[-170]C)-string1)/string2 "in excel
VBA ?

Seems like VBA understands test="=SUM(R[-181]C:R[-170]C)-string1 but not
when dividing by one more string

HELP

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default implement test="=(SUM(R[-181]C:R[-170]C)-string1)/string2 "inV


This works:
teststreng = "=SUM(R[" & s - 183 & "]C:R[" & s - 172 & "]C)-" & Costs &""

This does not work:
teststreng = "=(SUM(R[" & s - 183 & "]C:R[" & s - 172 & "]C)-" & Costs &
")/" & Depreciation & ""


This is what teststreng is for( just pasting the value in to cells):
Worksheets("VaR").Cells((p), (q)).Activate ' p and q are counting varaibles
ActiveCell.FormulaR1C1 = teststreng


But it does accept depreciation and assigns it the right number, teststreng
accepts it but the trouble is in ActiveCell. Formula part.

Thank you:-)

"Tom Ogilvy" wrote:

I think you would get a better answer if you gave a specific example that
works and a specific example that does not work. Also, once assigned to the
variable "test", what do you intend to do with "test".

--
Regards,
Tom Ogilvy


"Monika" wrote:

How do I implement: test="=(SUM(R[-181]C:R[-170]C)-string1)/string2 "in excel
VBA ?

Seems like VBA understands test="=SUM(R[-181]C:R[-170]C)-string1 but not
when dividing by one more string

HELP

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default implement test="=(SUM(R[-181]C:R[-170]C)-string1)/string2 "inV

demo'd from the immediate window:
costs = 100
Depreciation = .5
s = 200
activeCell.FormulaR1C1 = "=(SUM(R[" & s - 183 & "]C:R[" & s - 172 & "]C)-" &
Costs & ")/" & Depreciation & ""
? activecell.Formula
=(SUM(A18:A29)-100)/0.5
? activecell.FormulaR1C1
=(SUM(R[17]C:R[28]C)-100)/0.5

so that formula worked fine for me as long as the variables were defined.

--
Regards,
Tom Ogilvy


"Monika" wrote:


This works:
teststreng = "=SUM(R[" & s - 183 & "]C:R[" & s - 172 & "]C)-" & Costs &""

This does not work:
teststreng = "=(SUM(R[" & s - 183 & "]C:R[" & s - 172 & "]C)-" & Costs &
")/" & Depreciation & ""


This is what teststreng is for( just pasting the value in to cells):
Worksheets("VaR").Cells((p), (q)).Activate ' p and q are counting varaibles
ActiveCell.FormulaR1C1 = teststreng


But it does accept depreciation and assigns it the right number, teststreng
accepts it but the trouble is in ActiveCell. Formula part.

Thank you:-)

"Tom Ogilvy" wrote:

I think you would get a better answer if you gave a specific example that
works and a specific example that does not work. Also, once assigned to the
variable "test", what do you intend to do with "test".

--
Regards,
Tom Ogilvy


"Monika" wrote:

How do I implement: test="=(SUM(R[-181]C:R[-170]C)-string1)/string2 "in excel
VBA ?

Seems like VBA understands test="=SUM(R[-181]C:R[-170]C)-string1 but not
when dividing by one more string

HELP

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,440
Default implement test="=(SUM(R[-181]C:R[-170]C)-string1)/string2 "inV

If there are decimal separators in Depreciation, they should be the International ones, not your local ones.
Or use the FormulaR1C1Local property instead.

--
Kind regards,

Niek Otten


"Monika" wrote in message ...

This works:
teststreng = "=SUM(R[" & s - 183 & "]C:R[" & s - 172 & "]C)-" & Costs &""

This does not work:
teststreng = "=(SUM(R[" & s - 183 & "]C:R[" & s - 172 & "]C)-" & Costs &
")/" & Depreciation & ""


This is what teststreng is for( just pasting the value in to cells):
Worksheets("VaR").Cells((p), (q)).Activate ' p and q are counting varaibles
ActiveCell.FormulaR1C1 = teststreng


But it does accept depreciation and assigns it the right number, teststreng
accepts it but the trouble is in ActiveCell. Formula part.

Thank you:-)

"Tom Ogilvy" wrote:

I think you would get a better answer if you gave a specific example that
works and a specific example that does not work. Also, once assigned to the
variable "test", what do you intend to do with "test".

--
Regards,
Tom Ogilvy


"Monika" wrote:

How do I implement: test="=(SUM(R[-181]C:R[-170]C)-string1)/string2 "in excel
VBA ?

Seems like VBA understands test="=SUM(R[-181]C:R[-170]C)-string1 but not
when dividing by one more string

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
Reverse $String1, String2 to $String2 $String1? msnyc07 Excel Worksheet Functions 1 April 28th 10 10:34 PM
Reorder $String1, $String2 to $String1 $String2? msnyc07 Excel Worksheet Functions 1 April 21st 10 04:24 PM
Complex if test program possible? If "value" "value", paste "value" in another cell? jseabold Excel Discussion (Misc queries) 1 January 30th 06 10:01 PM
how do i write and implement "pop-up" help for a user defined func Velvetlady Excel Programming 1 August 2nd 05 06:46 PM
Looking for VB code to test for "RING" , "BUSY" disconnects or other signals BruceJ[_2_] Excel Programming 3 November 20th 03 01:55 AM


All times are GMT +1. The time now is 09:11 PM.

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

About Us

"It's about Microsoft Excel"