I have the following code that grabs data from Sheet1 based on ID column
Code: Select all
Sub Test()
Dim Col As New Collection, Arr, I As Long, J As Long
On Error Resume Next
Arr = Sheet1.Range("A7:J" & Sheet1.Cells(Rows.Count, "A").End(xlUp).Row).Value
For I = 2 To UBound(Arr, 1)
For J = 2 To UBound(Arr, 2)
Col.Add Key:=J & Chr(2) & Arr(I, 1), Item:=Arr(I, J)
Next J
Next I
With Sheet2.Range("A7:J" & Sheet2.Cells(Rows.Count, "A").End(xlUp).Row)
Arr = .Value
For I = 2 To UBound(Arr, 1)
For J = 2 To UBound(Arr, 2)
Arr(I, J) = Col(J & Chr(2) & Arr(I, 1))
Next J
Next I
.Value = Arr
End With
End Sub
I need to copy the same format of the original grabbed row and the same column width .. the same font and the same font color.
for example : In Sheet1 row 9
The row height is 35 ..the data is horizontal centered and vertical centered ..the font name is "Arial" and the font color is red
I want to copy all the formats of the row when grabbed into sheet2 ..
Hope this will be clear enough when you peruse the test file ... thank you for your cooperation in advance