Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

copy values from a row to a column

Status
Not open for further replies.

raptorius

Technical User
Jun 26, 2003
6
CA
Hi,

I want to copy some values from a row and paste them into a column.
It will be used for a monthly report. After pressing a button the values of the row from the monthly report must be selected and pasted into a column of another workbook for further analysis

 
This should get you started - best bet for stuff like this is to use the MAcro Recorder (Tools>Macros>Record Macro) to record yourself performing the action and then adjust the code to make it more dynamic.

Dim tWBsht as worksheet, dWBsht as worksheet

Set tWBsht = thisworkbook.sheets("datasheetname")
set dWBsht = workbooks("Furtheranalysisworkbook").sheets("destinationsheetname")

tWBsht.range("copyRange").copy
dWBsht.range("A1").select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=True

Rgds, Geoff
It's Super Happy Campo Funtime!
Want the best answers to your questions ? - then read me baby one more time - faq222-2244
 

This would copy Row 3 of Book1 into Column B of Book2.

Sub tranzpoze()
Set w1 = Workbooks("Book1").Worksheets("Sheet1")
Set w2 = Workbooks("Book2").Worksheets("Sheet1")
RowToPaste = 3
ColtoCopyTo = 2
For i = 1 To 256
w2.Cells(i, ColtoCopyTo) = w1.Cells(RowToPaste, i)
Next i
Set w1 = Nothing
Set w2 = Nothing
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top