#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Array Help

I am relatively new to VBA programming but not VB. For my current
project I need to copy a cell to an array and paste it into a
spreadsheet only if a certain criteria is met, such as the number 3 in
column 9. Which corresponds to a drop down box. I would then need to
paste that cell into the first
pre-determined non occupied cell on a different worksheet. I would
like to do this using an array since it makes the most sense. I am
thinking one array for the copied cells and a second array that has
cell references on the second sheet. My hang up is the first array.
How do I only copy certains cells into an array if a certain criteria
must be met.

Thanks in advance,
John
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Array Help

Maybe something like this:

Dim varr(1 to 10) as Variant
Dim i as long
Dim varr1 as Variant

Varr1 = Array("A1","B9","C11","D12","Z1", _
"Z14","B2","A13","B15","C21")
i = 1
for each cell in Range("A1").Resize(10,1)
if cell.offset(0,5).value = 9
varr(i) = cell.value
i = i + 1
End if
Next

for i = 1 to 10
if not isempty(varr(i)) then
Worksheets(2).Range(varr1(i-1)).Value = varr(i)
end if
Next

--
Regards,
Tom Ogilvy



"John" wrote in message
m...
I am relatively new to VBA programming but not VB. For my current
project I need to copy a cell to an array and paste it into a
spreadsheet only if a certain criteria is met, such as the number 3 in
column 9. Which corresponds to a drop down box. I would then need to
paste that cell into the first
pre-determined non occupied cell on a different worksheet. I would
like to do this using an array since it makes the most sense. I am
thinking one array for the copied cells and a second array that has
cell references on the second sheet. My hang up is the first array.
How do I only copy certains cells into an array if a certain criteria
must be met.

Thanks in advance,
John



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
Complex conditional summing - array COUNT works, array SUM gives#VALUE fatcatfan Excel Worksheet Functions 4 November 18th 09 06:41 PM
Array formula: how to join 2 ranges together to form one array? Rich_84 Excel Worksheet Functions 2 April 1st 09 06:38 PM
Prevent cell/array references from changing when altering/moving thecell/array nme Excel Discussion (Misc queries) 1 September 19th 08 01:53 PM
meaning of : IF(Switch; Average(array A, array B); array A) DXAT Excel Worksheet Functions 1 October 24th 06 06:11 PM
combining cells and array from different sheets into an array to pass to IRR() [email protected] Excel Discussion (Misc queries) 3 September 11th 06 07:17 AM


All times are GMT +1. The time now is 03:16 AM.

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"