JMcAnarney
New Member
- Joined
- Nov 2, 2021
- Messages
- 20
- Office Version
- 2016
- Platform
- Windows
- Web
Question,
What is the VBA code I would need to write in order to create a long list from all the sheets on my excel document. For example, I need to compile (similar to a data set) the cell range of L49 to AD49 down to L62 to AD62. I am doing it this way in order to compile out large data set in hopes to create a PIVOT table. The other way would be copying and pasting which would take far too long.
The code I have established combines ALL the sheets information which is what I do not want; just that specified range:
Sub Combine()
'UpdatebyExtendoffice20180205
Dim I As Long
Dim xRg As Range
On Error Resume Next
Worksheets.Add Sheets(1)
ActiveSheet.Name = "Combined"
For I = 2 To Sheets.Count
Set xRg = Sheets(1).UsedRange
If I > 2 Then
Set xRg = Sheets(1).Cells(xRg.Rows.Count + 1, 1)
End If
Sheets(I).Activate
ActiveSheet.UsedRange.Copy xRg
Next
End Sub
Any help?
What is the VBA code I would need to write in order to create a long list from all the sheets on my excel document. For example, I need to compile (similar to a data set) the cell range of L49 to AD49 down to L62 to AD62. I am doing it this way in order to compile out large data set in hopes to create a PIVOT table. The other way would be copying and pasting which would take far too long.
The code I have established combines ALL the sheets information which is what I do not want; just that specified range:
Sub Combine()
'UpdatebyExtendoffice20180205
Dim I As Long
Dim xRg As Range
On Error Resume Next
Worksheets.Add Sheets(1)
ActiveSheet.Name = "Combined"
For I = 2 To Sheets.Count
Set xRg = Sheets(1).UsedRange
If I > 2 Then
Set xRg = Sheets(1).Cells(xRg.Rows.Count + 1, 1)
End If
Sheets(I).Activate
ActiveSheet.UsedRange.Copy xRg
Next
End Sub
Any help?