Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
It possible to multiply one cell by...?
Hi,
I'm trying to multiply a range of values (A1:A20) by a fixed numbe contained in a cell (c1) only if it equals certain condition. (A1,A2,....etc. = D1). (from VBA). Any idea? Thanks a lot jose lui -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
It possible to multiply one cell by...?
Hi
try sub foo() dim rng as range dim cell as rng with activesheet set rng = .range("A1:A20") for each cell in rng if cell.value=.range("D1").value cell.value=cell.value*2 end if next end with end sub -- Regards Frank Kabel Frankfurt, Germany "jose luis " schrieb im Newsbeitrag ... Hi, I'm trying to multiply a range of values (A1:A20) by a fixed number contained in a cell (c1) only if it equals certain condition. (A1,A2,....etc. = D1). (from VBA). Any idea? Thanks a lot jose luis --- Message posted from http://www.ExcelForum.com/ |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
It possible to multiply one cell by...?
Thank you Frank
I think your proposal is the solution to my problem. Now i 'm havin troubles with the syntaxis. When I run the Macro i get a "user-define type not defined". I think the assigment of rng as Range and then cel as rng is not working. Could you continue helping me to get this done? As you see I 'm not very knowlegdable in VBA .But "with a little hel from my friends" all can be done. Thanks again!!! Jose Luis Monterrey Mexico What an amazing thing is the Internet!!!, I can stop be surprised! b the COMMUNity achieved -- Message posted from http://www.ExcelForum.com |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
It possible to multiply one cell by...?
I haven't seen the code, but if you have
Dim Rng As Range Dim Cell As Range Rng is a variable, not a prototype for another variable. The prototype for both is Range. On Sun, 12 Sep 2004 17:32:08 -0500, jose luis wrote: Thank you Frank I think your proposal is the solution to my problem. Now i 'm having troubles with the syntaxis. When I run the Macro i get a "user-defined type not defined". I think the assigment of rng as Range and then cell as rng is not working. Could you continue helping me to get this done? As you see I 'm not very knowlegdable in VBA .But "with a little help from my friends" all can be done. Thanks again!!! Jose Luis Monterrey Mexico What an amazing thing is the Internet!!!, I can stop be surprised! by the COMMUNity achieved. --- Message posted from http://www.ExcelForum.com/ |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
It possible to multiply one cell by...?
Sub TryThis()
'Llamemos Valor al rango que 'contiene el valor que has 'llamado fixed number Dim Valor As Range Set Valor = Range("C1") 'Los Valores que seran multiplicados por 'el valor que se encuentra en la celda 'Range("C1"), "Valor" 'los identificaremos con Rg Dim Rg As Range Set Rg = Range("A1:A20") 'Y aqui la operacion 'propiamente dicha: Valor.Copy Rg.PasteSpecial _ Paste:=xlPasteAll, _ Operation:=xlMultiply, _ SkipBlanks:=False, _ Transpose:=False End Su -- Message posted from http://www.ExcelForum.com |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
It possible to multiply one cell by...?
Thank you all!!!
Frank Myrna Andoni Your advice was followed and the task completed!!! The Andoni's solution was helpfull to learn a new approach to th problem. Myrna's advice was the key to make run the Macro proposed b Frank. I just change the rng definition and the macro ran. Thank you all again, hope to see you around!! Regards Jose Lui -- Message posted from http://www.ExcelForum.com |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
It possible to multiply one cell by...?
Hi
typoe: replace dim cell as rng with dim cell as range -- Regards Frank Kabel Frankfurt, Germany "jose luis " schrieb im Newsbeitrag ... Thank you Frank I think your proposal is the solution to my problem. Now i 'm having troubles with the syntaxis. When I run the Macro i get a "user-defined type not defined". I think the assigment of rng as Range and then cell as rng is not working. Could you continue helping me to get this done? As you see I 'm not very knowlegdable in VBA .But "with a little help from my friends" all can be done. Thanks again!!! Jose Luis Monterrey Mexico What an amazing thing is the Internet!!!, I can stop be surprised! by the COMMUNity achieved. --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I multiply ALL CELL in spreadsheet at once by .5 ? | Excel Worksheet Functions | |||
If cell contains a value, multiply... | Excel Worksheet Functions | |||
how do i multiply a cell by % | Excel Discussion (Misc queries) | |||
add value of 4 cells, multiply by 3 subtract 72 multiply by 80% | Excel Discussion (Misc queries) | |||
multiply the value of a cell | Excel Worksheet Functions |