Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Reference 5 cells offset from another for copying.

Hi,
The following allows me to address the start of 5 cells I want to copy to
another sheet.
How do I correctly address those 5 cells, which are offset 5 places form the
cell which matches a string on the other sheet, and then paste it to the
sheet, 20 places horizontally from the cells which matches the string on the
previous sheet.

I'm using a match function to locate cells on two sheets then trying to copy
5 cells from one sheet to the other sheet but the location is different.
The five cells which need to be copied are in columns "J to N" on one sheet
which uses Column "E"as reference point and Columns "Z to AD" on the other
sheet which also uses Column "F" .

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


Set rng4 = Sheet1.Range("F2:F65536").Find(what:=z) 'find the correct
cell
Set rng6 = rng4.Offset(0, 20) ' 0 cells down 5 cells across
rng5.Copy Destination:=Sheet2.Range(rng6.Address) '.PasteSpecial '
copy the value

Please help.
--
Regards
Bill
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
changing worksheet reference name when copying down cells ferne Excel Worksheet Functions 5 May 20th 10 02:55 AM
offset reference shashidhar Excel Worksheet Functions 1 March 23rd 08 09:33 PM
Using an offset formula for the reference in a relative reference Cuda Excel Worksheet Functions 6 November 15th 06 05:12 PM
Code to reference offset cells - NCAA rudawg Excel Programming 0 March 12th 06 04:04 PM
Problems copying cells using offset and counta hlckom Excel Discussion (Misc queries) 4 January 30th 05 12:49 AM


All times are GMT +1. The time now is 08:38 PM.

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"