Removing headers

mano

New Member
Joined
Aug 24, 2006
Messages
2
Help needed
I need to make Pivot Tables from Data Consolidated from multiple pages.
The Data is of same format and has the same Headers.
The “Consolidate” procedure works just fine but the “GetRange” procedure is giving me problems.
Why do I need the “GetRange” procedure?
Well, its simple.
The multiple sheets are copied with headers.
Using the “GetRange” procedure I choose from which row to copy data i.e. without headers.
From the
“For ii = 3 To Sheets.Count 'from third list onwards”
The first sheet is copied ok
But when the next sheet is copied, it is not pasted.

NB: the file to contain this module must have a sheet.name = “form” in which the market Header is designed.
['=============================================================================================
'Assuming we have one Workbook named "Consolidate" which consolidates data from its different
'pages, we are in a position to make a pivot table.
'=============================================================================================
Sub consolidate()
On Error Resume Next
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Sheets("ConsolidatedData").Delete
Sheets.Add Before:=Sheets(1)
Sheets(1).Name = "ConsolidatedData"

'the If proceedure always makes the sheet containing the form second
If Sheets(1).Name = "ConsolidatedData" Then
Sheets("form").Select
Application.CutCopyMode = False
Sheets("form").Move Before:=Sheets(2)
End If

GetHeader
'the cycle that copies all Data into the sheet named "ConsolidatedData"
Dim ii As Long
For ii = 3 To Sheets.Count 'from third list onwards
Sheets(ii).Activate ' change the active range to copy
GetRange
With Sheets(1).Cells(Rows.Count, 1).End(xlUp).Offset(1)
.PasteSpecial xlValues
End With
Next ii
Application.DisplayAlerts = True
Application.ScreenUpdating = True
Range("a1").Activate
End Sub

Sub GetHeader()
Workbooks("Consolidate").Worksheets("form").Select
Application.Goto Reference:="header"
Application.CutCopyMode = False
Selection.Copy
Sheets("ConsolidatedData").Select
Range("A1").Select
ActiveSheet.Paste
Columns("A:G").Select
Selection.ColumnWidth = 15
Range("A4").Select
End Sub

'=====================================================================
'this procedure excludes all rows pertaining to the Hearder
'
'A strange fact!!!!!
' When the procedure getRange is executed
' It copies the first page "Ëèñò5" but not the second "Ëèñò4"
'please help!!!
'=====================================================================

Sub GetRange()
Dim q As Integer

q = InputBox("How many rows not to copy?")

Workbooks("Consolidate").ActiveSheet.Range(Cells(q, 1), _
Cells(Workbooks("Consolidate").ActiveSheet.Rows.Count, _
Workbooks("Consolidate").ActiveSheet.Columns.Count)).Select
Selection.Copy

End Sub




][/code]
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.

Forum statistics

Threads
1,226,217
Messages
6,189,687
Members
453,563
Latest member
Aswathimsanil

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top