Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 81
Default Move and Link2

My apologies I posted the same question earlier but I just realized that I
didnt make my question very clear. I am trying to repeat the code below so
that it covers every cell in the range A4:A200 as well as AK4:AK200
In Sheet 1 copy range A4:H4. In Sheet 2 paste A4:H4 into cell B5. Next link
cell B4 in Sheet 2 to cell AK4 in Sheet1. Afterwards return to Sheet 1 copy
range A5:H5. In Sheet 2 paste A5:H5 into cell B7. Next link cell B6 in
Sheet 2 to cell AK5 in Sheet1. Repeat the pattern until every cell in range
A4:H200 has been covered. Here is what I have so far.

Sub Moveandlink()
Application.Goto Reference:="R4C1:R4C8"
Selection.Copy
Sheets("Sheet 2").Select
Range("B5").Select
ActiveSheet.Paste
Range("B4").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "='Sheet 1'!RC[35]"
Range("B5").Select
Sheets("Sheet 1").Select
Application.Goto Reference:="R5C1:R5C8"
Selection.Copy
Sheets("Sheet 2").Select
Range("B7").Select
ActiveSheet.Paste
Range("B6").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "='Sheet 1'!R[-1]C[35]"
Range("B7").Select
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Move and Link2

A bit confusing because your code does not appear to do quite what you
describe, so you may need to adapt the following:

Sub abc()
Dim rw As Long
Dim rngSource As Range
Dim rngDest As Range
Dim rng As Range

Set rngSource = Worksheets("Sheet 1").Range("A4:H200")
Set rngDest = Worksheets("Sheet 2").Range("B4")

With rngSource
Set rngDest = rngDest.Resize(.Rows.Count * 2, .Columns.Count)
End With

For Each rng In rngSource.Rows
rw = rw + 2
rngDest.Rows(rw).Value = rng.Value
Next

Set rngSource = Worksheets("Sheet 1").Range("Ak4:AK200")
rw = -1
For Each rng In rngSource
rw = rw + 2
rngDest(rw, 1).Formula = "=" & rng.Address(external:=True)
Next

End Sub

Regards,
Peter T

"TGalin" wrote in message
...
My apologies I posted the same question earlier but I just realized that I
didn't make my question very clear. I am trying to repeat the code below
so
that it covers every cell in the range A4:A200 as well as AK4:AK200
In Sheet 1 copy range A4:H4. In Sheet 2 paste A4:H4 into cell B5. Next
link
cell B4 in Sheet 2 to cell AK4 in Sheet1. Afterwards return to Sheet 1
copy
range A5:H5. In Sheet 2 paste A5:H5 into cell B7. Next link cell B6 in
Sheet 2 to cell AK5 in Sheet1. Repeat the pattern until every cell in
range
A4:H200 has been covered. Here is what I have so far.

Sub Moveandlink()
Application.Goto Reference:="R4C1:R4C8"
Selection.Copy
Sheets("Sheet 2").Select
Range("B5").Select
ActiveSheet.Paste
Range("B4").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "='Sheet 1'!RC[35]"
Range("B5").Select
Sheets("Sheet 1").Select
Application.Goto Reference:="R5C1:R5C8"
Selection.Copy
Sheets("Sheet 2").Select
Range("B7").Select
ActiveSheet.Paste
Range("B6").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "='Sheet 1'!R[-1]C[35]"
Range("B7").Select
End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 81
Default Move and Link2

Thanks for the tip. I am kind of new at this so I could understand why this
would come across as confusing. I think some of the blur might have been
caused because I used the go to cell command instead of just clicking on the
cell I wanted. Whatever the case, this does exactly what I was trying to do
and very well I might add. Thank you for you're help!

"Peter T" wrote:

A bit confusing because your code does not appear to do quite what you
describe, so you may need to adapt the following:

Sub abc()
Dim rw As Long
Dim rngSource As Range
Dim rngDest As Range
Dim rng As Range

Set rngSource = Worksheets("Sheet 1").Range("A4:H200")
Set rngDest = Worksheets("Sheet 2").Range("B4")

With rngSource
Set rngDest = rngDest.Resize(.Rows.Count * 2, .Columns.Count)
End With

For Each rng In rngSource.Rows
rw = rw + 2
rngDest.Rows(rw).Value = rng.Value
Next

Set rngSource = Worksheets("Sheet 1").Range("Ak4:AK200")
rw = -1
For Each rng In rngSource
rw = rw + 2
rngDest(rw, 1).Formula = "=" & rng.Address(external:=True)
Next

End Sub

Regards,
Peter T

"TGalin" wrote in message
...
My apologies I posted the same question earlier but I just realized that I
didn't make my question very clear. I am trying to repeat the code below
so
that it covers every cell in the range A4:A200 as well as AK4:AK200
In Sheet 1 copy range A4:H4. In Sheet 2 paste A4:H4 into cell B5. Next
link
cell B4 in Sheet 2 to cell AK4 in Sheet1. Afterwards return to Sheet 1
copy
range A5:H5. In Sheet 2 paste A5:H5 into cell B7. Next link cell B6 in
Sheet 2 to cell AK5 in Sheet1. Repeat the pattern until every cell in
range
A4:H200 has been covered. Here is what I have so far.

Sub Moveandlink()
Application.Goto Reference:="R4C1:R4C8"
Selection.Copy
Sheets("Sheet 2").Select
Range("B5").Select
ActiveSheet.Paste
Range("B4").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "='Sheet 1'!RC[35]"
Range("B5").Select
Sheets("Sheet 1").Select
Application.Goto Reference:="R5C1:R5C8"
Selection.Copy
Sheets("Sheet 2").Select
Range("B7").Select
ActiveSheet.Paste
Range("B6").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "='Sheet 1'!R[-1]C[35]"
Range("B7").Select
End Sub




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
Excel arrows don't move black box but move the window Thebit Excel Discussion (Misc queries) 1 April 13th 09 02:06 AM
Find value and move to end of data in same row then move values in Diddy Excel Programming 9 March 30th 09 11:24 AM
excel-how to get the spreadsheet to move as I move the scroll tab excel toiler Excel Discussion (Misc queries) 6 November 7th 07 06:07 PM
How do I stop making the spreadsht move when I move up/dwn/lt/rt? Manny Excel Worksheet Functions 4 April 7th 06 10:30 PM
When I move scroll bar in excell the contents do not move with it ramneek Excel Discussion (Misc queries) 2 June 29th 05 07:35 PM


All times are GMT +1. The time now is 10:59 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"