View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default a script/macro to copy a block of cells next to specified cells

Dim rng as Range
Marker as Variant
Dim cell as Range
Marker = "some value"
set rng = Range(Range("B3"), _
Cells(rows.count,1).End(xlup).offset(0,1))
rng.Filldown
for each cell in rng
if cell.value = marker then
Range("C1:D1").copy Destination:=cell.offset(0,1)
end if
Next

--
Regards,
Tom Ogilvy



wrote in message
...

-----Original Message-----
set rng = Range(Range("B3"),Cells(rows.count,1).End

(xlup).offset(0,1))
rng.Filldown


Don't understand you question 2.


Yes, it's clumsy... so let me try again, in a slightly
less clumsy way:

2. I have a block of cells in, e.g., c1, c2, d1 and d2,
which I'd like this macro to copy next to the individual
value/marker calculated in column b by the first part of
the macro. This marker (it can be a character) is the
result of a TRUE/FALSE test on the data from column a,
thus only a small percentage of cells in column b will be
filled. That's where, i.e., next to it in col. c, I'd
like the macro to copy the block of formulas, which would
use data in column a to givea block of new data.

Thanks for your help,

z.entropic


--
Regards,
Tom Ogilvy


"z.entropic" wrote in message
...
Here's what I'd like to do:

1. copy cell b3 all the way down to b(n), where n is the
number of data in column a; this produces some cells in
column b with a numerical value or character;
2. copy a block of cells, e.g., b1-c2, where cell b1
would be placed in column c next to every occurrence of
the previous numerical value.

I believe a simple macro can't do it, only a VBA scipt
could, but am no expert at it...

Help would be much appreciated.

z.entropic



.