View Single Post
  #2   Report Post  
bj
 
Posts: n/a
Default

there are several ways to do it.

if you want to copy a hundred cells for three columns every time something
in row 3 is matched
somehting like the following could be used.

sub try()
tar=1 ' target column in sheet 2
for c = 1 to 34 step 3 ' this will be the look up column in sheet 1
if sheets("Sheet1").Cells(c,3)=comparison value then
for sr=1 to 100 'Source row
for sc=0 to 2 ' source column
sheets("Sheet2").Cells(sr,tar+sc)=sheets("Sheet1") .cells(sr,c+sc)
next sc
next sr
tar = tar +3
end if
next c
end sub

I would make it more formal with dim statements etc. for actual use

"mattguerilla" wrote:

I want to use code in a macro to search for criteria in a worksheet which
allows the matched data to be copied (along with other relevant columns) to
another worksheet in the same file. Would this involve some sort of loop?
Any help apreciated.

Thanks in advance,

Matt