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
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