Solved

# find row and then copy a range

Posted on 2013-06-05
Medium Priority
246 Views
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
Question by:CC10
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• 2

Accepted Solution

psmitty earned 1200 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
``````
0

Author Comment

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

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

## Featured Post

Question has a verified solution.

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

How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
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 …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
###### Suggested Courses
Course of the Month8 days, 17 hours left to enroll