ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   if macro (https://www.excelbanter.com/excel-programming/278595-if-macro.html)

Sam

if macro
 
in column a , from a2 i have dates

in column b , from b2 , i have stock price

in column c , from c2 , i have nasdaq values

my data length will change ....may be 100 rows of data or 10000...

what i m looking for is a macro do to :

if values in cells in column c are 0

then in column d i want those dates
in column e i want corr values from column b and in column F i want column c
values....


sam

Tom Ogilvy

if macro
 
No need to use a macro, use a formula

in D2 put int
=if($c20,A2,"")
in E2
=if($C20,B2,"")

in F2
=if($C20,F2,"")

then select D2:F2 and drag fill down the column


with code

Dim rng as Range
set rng = Range(Cells(2,1),Cells(rows.count,1).End(xlup))
rng.offset(3,0).Resize(,3).formula = "=($C20,A2,"""")"
' to make hard coded values rather than formulas - optional
'rng.offset(0,3).Resize(,3).Formula = rng.offset(0,3).Resize(,3).Value


Should do it.

--
Regards,
Tom Ogilvy



"Sam" wrote in message
m...
in column a , from a2 i have dates

in column b , from b2 , i have stock price

in column c , from c2 , i have nasdaq values

my data length will change ....may be 100 rows of data or 10000...

what i m looking for is a macro do to :

if values in cells in column c are 0

then in column d i want those dates
in column e i want corr values from column b and in column F i want

column c
values....


sam





All times are GMT +1. The time now is 12:14 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com