Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Formula - Macro
Hi
How do I have to code the below procedure in a macro properly? ATLN40 = "=Sum(B2:B4)" I want to diplay the result in other cell. I have the following code: Range("A1").Value= ATLN40 & " - 20's" What I am getting now in Range A1 is =Sum(B2:B4) - 20's , not the result of the sum. Could anyone help me please? Thanks, Orquidea |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Formula - Macro
Try this.........
Range("A1").Value = "=concatenate(SUM(B2:B4) & "" - 20 's"")" Vaya con Dios, Chuck, CABGx3 "orquidea" wrote: Hi How do I have to code the below procedure in a macro properly? ATLN40 = "=Sum(B2:B4)" I want to diplay the result in other cell. I have the following code: Range("A1").Value= ATLN40 & " - 20's" What I am getting now in Range A1 is =Sum(B2:B4) - 20's , not the result of the sum. Could anyone help me please? Thanks, Orquidea |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Formula - Macro
Thanks for your answer.
I still need the variable ATLN40 = (the total of the sum) bacause I will use the result of this variable for other calculation, so I will need to refer to ATLN40. Usted tambien vaya con Dios "CLR" wrote: Try this......... Range("A1").Value = "=concatenate(SUM(B2:B4) & "" - 20 's"")" Vaya con Dios, Chuck, CABGx3 "orquidea" wrote: Hi How do I have to code the below procedure in a macro properly? ATLN40 = "=Sum(B2:B4)" I want to diplay the result in other cell. I have the following code: Range("A1").Value= ATLN40 & " - 20's" What I am getting now in Range A1 is =Sum(B2:B4) - 20's , not the result of the sum. Could anyone help me please? Thanks, Orquidea |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
Formula - Macro
If you don't get anything any better, this will work for a small range...
atln40 = Range("b2").Value + Range("b3").Value + Range("b4").Value or you can compute the sum on the sheet in a helper cell and then refer to that cell for the total Vaya con Dios, Chuck, CABGx3 "orquidea" wrote: Thanks for your answer. I still need the variable ATLN40 = (the total of the sum) bacause I will use the result of this variable for other calculation, so I will need to refer to ATLN40. Usted tambien vaya con Dios "CLR" wrote: Try this......... Range("A1").Value = "=concatenate(SUM(B2:B4) & "" - 20 's"")" Vaya con Dios, Chuck, CABGx3 "orquidea" wrote: Hi How do I have to code the below procedure in a macro properly? ATLN40 = "=Sum(B2:B4)" I want to diplay the result in other cell. I have the following code: Range("A1").Value= ATLN40 & " - 20's" What I am getting now in Range A1 is =Sum(B2:B4) - 20's , not the result of the sum. Could anyone help me please? Thanks, Orquidea |
#5
Posted to microsoft.public.excel.misc
|
|||
|
|||
Formula - Macro
Maybe...
Dim ATLN40 as double ATLN40 = application.sum(worksheets("somesheetname").range( "b2:b4")) worksheets("somesheetname").range("a1").value = ATLN40 & " - 20's" or worksheets("somesheetname").range("a1").value _ = format(ATLN40, "0.000") & " - 20's" ======= Or maybe if you want A1 to be a formula: with worksheets("somesheetname") .Range("a1").formula = "=SUM(B2:B4)&"" - 20's""" end with or maybe... .Range("a1").formula = "=text(SUM(B2:B4),""0.000"")&"" - 20's""" Depending on how you want it formatted. orquidea wrote: Hi How do I have to code the below procedure in a macro properly? ATLN40 = "=Sum(B2:B4)" I want to diplay the result in other cell. I have the following code: Range("A1").Value= ATLN40 & " - 20's" What I am getting now in Range A1 is =Sum(B2:B4) - 20's , not the result of the sum. Could anyone help me please? Thanks, Orquidea -- Dave Peterson |
#6
Posted to microsoft.public.excel.misc
|
|||
|
|||
Formula - Macro
Some lines from Dave's suggestions, and one from your original, seems to get
it.... Sub ConcatRangeSum() Dim ATLN40 As Double ATLN40 = Application.Sum(Worksheets("Sheet1").Range("b2:b4" ).Value) 'MsgBox ATLN40 Range("a1").Value = ATLN40 & " - 20 's" End Sub Vaya con Dios, Chuck, CABGx3 "orquidea" wrote: Thanks for your answer. I still need the variable ATLN40 = (the total of the sum) bacause I will use the result of this variable for other calculation, so I will need to refer to ATLN40. Usted tambien vaya con Dios "CLR" wrote: Try this......... Range("A1").Value = "=concatenate(SUM(B2:B4) & "" - 20 's"")" Vaya con Dios, Chuck, CABGx3 "orquidea" wrote: Hi How do I have to code the below procedure in a macro properly? ATLN40 = "=Sum(B2:B4)" I want to diplay the result in other cell. I have the following code: Range("A1").Value= ATLN40 & " - 20's" What I am getting now in Range A1 is =Sum(B2:B4) - 20's , not the result of the sum. Could anyone help me please? Thanks, Orquidea |
#7
Posted to microsoft.public.excel.misc
|
|||
|
|||
Formula - Macro
Thanks Dave for your help
"Dave Peterson" wrote: Maybe... Dim ATLN40 as double ATLN40 = application.sum(worksheets("somesheetname").range( "b2:b4")) worksheets("somesheetname").range("a1").value = ATLN40 & " - 20's" or worksheets("somesheetname").range("a1").value _ = format(ATLN40, "0.000") & " - 20's" ======= Or maybe if you want A1 to be a formula: with worksheets("somesheetname") .Range("a1").formula = "=SUM(B2:B4)&"" - 20's""" end with or maybe... .Range("a1").formula = "=text(SUM(B2:B4),""0.000"")&"" - 20's""" Depending on how you want it formatted. orquidea wrote: Hi How do I have to code the below procedure in a macro properly? ATLN40 = "=Sum(B2:B4)" I want to diplay the result in other cell. I have the following code: Range("A1").Value= ATLN40 & " - 20's" What I am getting now in Range A1 is =Sum(B2:B4) - 20's , not the result of the sum. Could anyone help me please? Thanks, Orquidea -- Dave Peterson |
#8
Posted to microsoft.public.excel.misc
|
|||
|
|||
Formula - Macro
Thanks for your help
"CLR" wrote: If you don't get anything any better, this will work for a small range... atln40 = Range("b2").Value + Range("b3").Value + Range("b4").Value or you can compute the sum on the sheet in a helper cell and then refer to that cell for the total Vaya con Dios, Chuck, CABGx3 "orquidea" wrote: Thanks for your answer. I still need the variable ATLN40 = (the total of the sum) bacause I will use the result of this variable for other calculation, so I will need to refer to ATLN40. Usted tambien vaya con Dios "CLR" wrote: Try this......... Range("A1").Value = "=concatenate(SUM(B2:B4) & "" - 20 's"")" Vaya con Dios, Chuck, CABGx3 "orquidea" wrote: Hi How do I have to code the below procedure in a macro properly? ATLN40 = "=Sum(B2:B4)" I want to diplay the result in other cell. I have the following code: Range("A1").Value= ATLN40 & " - 20's" What I am getting now in Range A1 is =Sum(B2:B4) - 20's , not the result of the sum. Could anyone help me please? Thanks, Orquidea |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Formula or Macro | Excel Discussion (Misc queries) | |||
Is there a Formula or Macro for This? | Excel Discussion (Misc queries) | |||
Macro Formula for Max value | Excel Worksheet Functions | |||
Macro Formula for Max value | Excel Worksheet Functions | |||
Add formula to Macro??? | New Users to Excel |