Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 863
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default 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
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
How do I multiply ALL CELL in spreadsheet at once by .5 ? ariel Excel Worksheet Functions 2 February 10th 10 06:08 PM
If cell contains a value, multiply... JFro Excel Worksheet Functions 3 September 15th 09 02:29 PM
how do i multiply a cell by % sanz Excel Discussion (Misc queries) 2 March 1st 07 06:48 AM
add value of 4 cells, multiply by 3 subtract 72 multiply by 80% George A. Yorks Excel Discussion (Misc queries) 10 October 25th 06 09:45 PM
multiply the value of a cell bruce pinkos Excel Worksheet Functions 1 September 16th 05 02:16 PM


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