Solved

find row and then copy a range

Posted on 2013-06-05
3
242 Views
Last Modified: 2013-06-08
In Sheet "B", I have a table. In the Sheet "A" I have a summary sheet. I would like a macro that selects a defined row in Sheet "B" and then copies(transposes) a range in that row to a defined range in Sheet "A".
The row is defined by inserting the row number in cell "A1" in Sheet "A". Then I will run the macro manually.
Examples:
Sheet "A" cell A1 :  insert the number 5.
Then in Sheet "B", range A5:G5, Select
Sheet "A", range C1:C8. paste/Transpose

Sheet "A" cell A1 :  insert the number 10.
Then in Sheet "B", range A10:G10, Select
Sheet "A", range C1:C8. paste/Transpose

Sheet "A" cell A1 :  insert the number 22.
Then in Sheet "B", range A22:G22, Select
Sheet "A", range C1:C8. paste/Transpose


Thanks
CC
0
Comment
Question by:CC10
  • 2
3 Comments
 

Accepted Solution

by:
psmitty earned 400 total points
ID: 39224036
Sub Macro x
Dim i
 i = ActiveSheet.Cells(1,1).Value
 Range("A" & i ":G" & i).Select
 Selection.Copy
 Sheets("Sheet B").Select
 Range("C1").Select
 Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:=False,  Transpose:=True
End Sub

Open in new window

0
 

Author Comment

by:CC10
ID: 39225051
This does not seem to work. Is the separator correct in the Range statement?

Also, the range to be copied is in Sheet B and then that should be pasted back into Sheet A in Range(C1)

The single cell to determine the row number in Sheet "B",  is Sheet"A". Cell(1,1)
The range is Sheet B, row i,A:G
It is pasted back into Sheet A, cell C1

Thanks
0
 

Author Closing Comment

by:CC10
ID: 39231946
Have solved it. The range statement was incorrect.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question