Hye Excel Expert,
Attached is the sample of web data for transpose process. Generally, each portion is a group of data consists of the following parameters:-
Work Order ID
Submit Date
Submitter
Communication Source
View Access
Notes
The source data (web data) is in horizontal mode and every portion is separated by a line. If we see the pattern for the value for each parameter, each parameter only has 1 row value, EXCEPT parameter 'Notes' that may vary from 1 portion to another. However, I need the output to be as the following (with sample data):-
Work Order ID Submit Date Submitter Communication Source View Access Notes
WO0000000075830 *04/01/2018 7:47:35 PM *v04784x * Public * User ID have been created.refer attachment.TQ.
I have hundreds of web data files in a folder in local PC. I need a macro that can loop all web data files in the folder, transpose each portion from horizontal (rows) to vertical (columns) manner with the parameter names as the header which needs only to be published once in one master worksheet. I manage to find one macro that can transpose but the macro only limits to a fixed number of columns, which will not be applicable when the number of rows as values in parameter 'Notes' is consists of multiple rows (inconsistent number of rows).
Below is the macro I found that I think very close-relation to my problem.
Public Sub TransposeData()
'updateby Extendoffice 20151207
Dim xLRow As Long
Dim xNRow As Long
Dim i As Long
Dim xUpdate As Boolean
Dim xRg As Range
Dim xOutRg As Range
Dim xTxt As String
On Error Resume Next
xTxt = ActiveWindow.RangeSelection.Address
Set xRg = Application.InputBox("Please select data range(only one column):", "Kutools for Excel", xTxt, , , , , 8)
Set xRg = Application.Intersect(xRg, xRg.Worksheet.UsedRange)
If xRg Is Nothing Then Exit Sub
If (xRg.Columns.Count > 1) Or _
(xRg.Areas.Count > 1) Then
MsgBox "the used range only contain one column", , "Kutools for Excel"
Exit Sub
End If
Set xOutRg = Application.InputBox("please select output range(specify one cell):", "Kutools for Excel", xTxt, , , , , 8)
If xOutRg Is Nothing Then Exit Sub
Set xOutRg = xOutRg.Range(1)
xUpdate = Application.ScreenUpdating
Application.ScreenUpdating = False
xLRow = xRg.Rows.Count
'For i = 1 To xLRow Step 5
For i = 1 To xLRow Step xLRow
'xRg.Cells(i).Resize(5).Copy
xRg.Cells(i).Resize(xLRow).Copy
xOutRg.Offset(xNRow, 0).PasteSpecial Paste:=xlPasteAll, Transpose:=True
xNRow = xNRow + 1
Next
Application.ScreenUpdating = xUpdate
End Sub
Can anyone help me, please?
Tqvm in advance.
DZ
Bookmarks