View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
justagrunt justagrunt is offline
external usenet poster
 
Posts: 12
Default Object required error - Still perservering with this code - Ideas

Hi,

I'm getting a "Object Required" error at

Set rng5.Resize(, 5) = rng10 'add 0 rows and 5 columns

which is part of

If Not IsError(res) Then
' they match, do something

z = ""
z = cell.Value 'set object from Match function

Set rng3 = Sheet2.Range("E2:E100").Find(what:=z) 'find the value in
sht2

Set rng5 = rng3.Offset(0, 5) '0 cells down 5 cells across is
the offset
Set rng5.Resize(, 5) = rng10 'add 0 rows and 5 columns


Set rng4 = Sheet1.Range("F2:F65536").Find(what:=z) 'find the correct
cell
Set rng6 = rng4.Offset(0, 20) ' 0 cells down 20 cells across is the
offset
Set rng6.Resize(, 5) = rng11 'add 0 rows and 4 columns to range
rng10.Copy Destination:=Sheet1.Range(rng11.Address) '.PasteSpecial
' copy the value


Else
' they don't match
End If
' continue the search
Next

Cn the above work or do I have to make 5 copies of the above to get a copy
paste which steps across 1 column at a time, five times - the offset.
Many thanks in advance
--
Regards
Bill