#1   Report Post  
Posted to microsoft.public.excel.programming
Sam Sam is offline
external usenet poster
 
Posts: 21
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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



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
Macro recorded... tabs & file names changed, macro hangs Steve Excel Worksheet Functions 3 October 30th 09 11:41 AM
need help to update macro to office 2007 macro enabled workbook jatman Excel Discussion (Misc queries) 1 December 14th 07 01:57 PM
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
My excel macro recorder no longer shows up when recording macro jack Excel Discussion (Misc queries) 1 February 5th 07 09:31 PM
My excel macro recorder no longer shows up when recording macro jack Excel Discussion (Misc queries) 3 February 5th 07 08:22 PM


All times are GMT +1. The time now is 05:49 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"