Hi, [FONT="Calibri"]This macro help to extract columns which is marked by “x” letter on row 1 but it’s only copy the data without format. How can I change the code to keep the format from OUT_COMBINED sheet after extracting data to EXPORT sheet? Pls help me with this matter, Thank you.
Code
[/FONT]Sub getColumn_outstanding()
Dim sArr(), dArr(), i As Long, J As Long, K As Long, c As Long, N As Long
Application.DisplayAlerts = False
With Sheets("OUTS_COMBINED")
c = .Range("A2").End(xlToRight).Column
sArr = .Range("A1", .Range("A2").End(xlDown)).Resize(, c).Value '.Resize(, c).Value
End With
ReDim dArr(1 To UBound(sArr), 1 To c)
For J = 1 To c
If sArr(1, J) <> Empty Then
N = N + 1
For i = 2 To UBound(sArr)
dArr(i - 1, N) = sArr(i, J)
Next i
End If
Next J
With Sheets("EXPORT")
.Range("A2").Resize(1000, 100).ClearContents
If N Then
.Range("A2").Resize(i - 1, N) = dArr
MsgBox "Done", , "getColumn_outstanding"
Else
MsgBox "Please enter x lettle above title row", , "getColumn"
End If
End With
Sheets("EXPORT").Select
Application.DisplayAlerts = True
End Sub[FONT="Calibri"]
Display More
[/FONT]