Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 74
Default Changing relative cell reference

I want to copy data from one work sheet (A) to another (B); instead of using
a normal relative cell reference (i.e., copy A1 to A1, A2 to A2, etc), I want
each row in worksheet A to be copied to every 31st row in worksheet A:

A2 in worksheet A should be copied to A2 in worksheet B
A3 in worksheet A should be copied to A32 in worksheet B
A4 in worksheet A should be copied to A63 in worksheet B .. etc

Thanks for your help!
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 464
Default Changing relative cell reference

Try something like;


Sub DoIt()
Dim wba As Workbook, wbb As Workbook
Dim wsCopy As Worksheet, wsPaste As Worksheet
Dim rCell As Range, lStop As Long
Dim lrow As Long

Set wba = ThisWorkbook
Set wsCopy = wba.Sheets(1)
Set wbb = Workbooks("Book1.xls")
Set wsPaste = wbb.Sheets(1)
lrow = 2

With wsCopy
lStop = .Cells( _
.Rows.Count, 1).End(xlUp).Row
End With

For Each rCell In Range("A1:A" & lStop)
rCell.Copy wsPaste.Cells(lrow, 1)
lrow = lrow + 31
Next rCell




End Sub



--
Regards
Dave Hawley
www.ozgrid.com
"richzip" wrote in message
...
I want to copy data from one work sheet (A) to another (B); instead of
using
a normal relative cell reference (i.e., copy A1 to A1, A2 to A2, etc), I
want
each row in worksheet A to be copied to every 31st row in worksheet A:

A2 in worksheet A should be copied to A2 in worksheet B
A3 in worksheet A should be copied to A32 in worksheet B
A4 in worksheet A should be copied to A63 in worksheet B .. etc

Thanks for your help!


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Changing relative cell reference

I'm confused by what you want.

A2, A32, A63, ...
Doesn't have the pattern you describe.

If you meant:
A2,A33,A64,A95, ...
You could put this formula in A2:
=INDEX('worksheet a'!A:A,(ROW()-2)*31+2)

if you meant:
A2,A32,A62,A92, ...
You could put this formula in A2:
=INDEX('worksheet a'!A:A,(ROW()-2)*30+2)

In either case, drag the formula down as far as you need.



richzip wrote:

I want to copy data from one work sheet (A) to another (B); instead of using
a normal relative cell reference (i.e., copy A1 to A1, A2 to A2, etc), I want
each row in worksheet A to be copied to every 31st row in worksheet A:

A2 in worksheet A should be copied to A2 in worksheet B
A3 in worksheet A should be copied to A32 in worksheet B
A4 in worksheet A should be copied to A63 in worksheet B .. etc

Thanks for your help!


--

Dave Peterson
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
Relative cell reference Roar Excel Discussion (Misc queries) 1 May 25th 07 01:23 PM
Changing Cells from Relative to Absolute Reference PZ Excel Discussion (Misc queries) 16 April 11th 07 08:22 PM
Relative Cell Reference Keith Excel Worksheet Functions 2 August 10th 06 05:22 AM
changing from relative to absolute cell reference in multiple form JAaron Excel Worksheet Functions 1 May 22nd 06 08:06 AM
changing multiple cells from relative to absolute reference Mike Excel Discussion (Misc queries) 4 March 10th 05 03:11 PM


All times are GMT +1. The time now is 12:10 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"