Need help with my code /transfer data/

cualquier

New Member
Joined
Nov 8, 2015
Messages
22
What is wrong?
I try to transfer data from active sheet to sheet(report) which contains 34 rows. I would like with every new sheet added as active sheet the new data to be transferred in a new column with the same 34 rows. The problem with this code is that in every column in all 34 rows is transferred the first value from range(“a1”) . This value is date and the others values are numbers.
I did it before with next row added, instead of 34 rows there was just 1 row but in 8 columns and works perfectly well. Now, change next row added with next column and resize not column but rows /34/.
How to transfer the data from active sheet /ws1/ to report sheet /ws2/in column?
Thank you!
P.S. Sorry for my English, it is not good, unfortunately, but hope to have explained the problem.

Sub posttoregister()
Dim ws1 As Worksheet
Dim ws2 As Worksheet
Set ws1 = ActiveSheet
Set ws2 = Worksheets("report")
nextcol = ws2.Cells(1, Columns.Count).End(xlToLeft).Column + 1
ws2.Cells(1, nextcol).Resize(34, 1).Value = Array(ws1.Range("a1"), ws1.Range("d1"), ws1.Range("d2"), ws1.Range("h1"), _
ws1.Range("d31"), ws1.Range("d32"), ws1.Range("h5"), ws1.Range("b4"), ws1.Range("b5"), ws1.Range("b6"), _
ws1.Range("b7"), ws1.Range("b8"), ws1.Range("b9"), ws1.Range("b10"), ws1.Range("b11"), ws1.Range("b12"), _
ws1.Range("b13"), ws1.Range("b14"), ws1.Range("b15"), ws1.Range("b16"), ws1.Range("b17"), ws1.Range("b18"), _
ws1.Range("b19"), ws1.Range("b20"), ws1.Range("b21"), ws1.Range("b22"), ws1.Range("b23"), ws1.Range("b24"), _
ws1.Range("b25"), ws1.Range("b26"), ws1.Range("b27"), ws1.Range("b28"), ws1.Range("b29"), ws1.Range("b31"))
End Sub
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

Forum statistics

Threads
1,215,096
Messages
6,123,074
Members
449,093
Latest member
ripvw

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top