![]() |
active cell
hi there,
i want to make a macro that takes the sum of cell (B1) for example and multiplies it by (A1), my problem is that i also want to apply the macro on other cells (like (B2)) so i want to have 2 active cells (one for taking sum of cells & the other to calculate the multiplication) - is it possible? e.g. A B C 1 2+3*5 MACRO OF SUM A1*B1 2 7+3*1 MACRO OF SUM A2*B2 3 6+5*2 MACRO OF SUM A3*B3 is it possible? thank u |
active cell
This is easily done but please re-state your requirements.
-- Don Guillett SalesAid Software "dodo" wrote in message ... hi there, i want to make a macro that takes the sum of cell (B1) for example and multiplies it by (A1), my problem is that i also want to apply the macro on other cells (like (B2)) so i want to have 2 active cells (one for taking sum of cells & the other to calculate the multiplication) - is it possible? e.g. A B C 1 2+3*5 MACRO OF SUM A1*B1 2 7+3*1 MACRO OF SUM A2*B2 3 6+5*2 MACRO OF SUM A3*B3 is it possible? thank u |
active cell
Why do you need a macro? Just type a formula into C column cells:
=A1*B1 |
active cell
hi all,
the reason that c1<a1*b1 is because a1 contains charactes that must be evaluated first befroe getting its sum. (eg. 25+3*1) u see this * do not let excel evalutes it automaticly, but using evalute function in vba let this possible. anyway i have figured it out as follows: Dim Rng1 As Range, Rng2 As Range Set Rng1 = ActiveCell Set Rng2 = ActiveCell.Offset(0, 1) Rng2.Value = Evaluate(Rng1.Value) many thanks |
active cell
hi all,
the reason that c1<a1*b1 is because a1 contains characters that must be evaluated first before getting its sum. (eg. 25+3*1) u see this * do not let excel evaluates it automatically, but using evaluate function in vba let this possible. anyway I have figured it out as follows: Dim Rang As Range, Rang As Range Set Rang = Active Set Rang = Active.Offset(0, 1) Rang.Value = Evaluate(Rang.Value) many thanks |
All times are GMT +1. The time now is 02:31 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com