I get data in this format:

Company 3			
Type	Number	Date	Month	Amount
Inv	13533	09/09/2011	September	251.88
Inv	13545	14/09/2011	September	115.12
Crd	CR13545	19/09/2011	September	-12.00
Inv	13549	16/09/2011	September	103.12
Inv	13556	19/09/2011	September	95.98
Inv	13560	21/09/2011	September	261.00
Inv	13582	03/10/2011	October	34.20
Inv	13589	06/10/2011	October	103.18
Inv	13615	17/10/2011	October	437.03
Inv	13631	25/10/2011	October	314.15
Company 2			
Type	Number	Date	Month	Amount
Inv	13664	04/11/2011	November	347.90
I need to perform subtotals on each company and am trying to do this in code.
How can I cyclce through each company selecting the range?
My current code is

Sub CalculateTotals()

Dim x As Integer, rownum As Integer, subcount As Integer

      NumRows = Range("A1", Range("A1").End(xlDown)).Rows.Count
      Range("A1").Select
      For x = 1 To 1000
        
        If ActiveCell.Text <> "Inv" And ActiveCell.Text <> "Crd" And ActiveCell.Text <> "" And ActiveCell.Text <> "Type" Then 'ie it's a company name
            'now select the range to do subtotals on
            ActiveCell.Offset(1, 0).Select 'move down 1 to the header row
            'now cycle through cells to see how many rows of invoices this company has
            subcount = 0
            ActiveCell.Offset(1, 0).Select 'move down 1 row
            'now cycle through to get count
            If ActiveCell.Text = "Inv" Or ActiveCell.Text = "Crd" Then
                subcount = subcount + 1
            
            
            
            
    Range("A2:E12").Select
    Selection.Subtotal GroupBy:=4, Function:=xlSum, TotalList:=Array(5), _
        Replace:=True, PageBreaks:=False, SummaryBelowData:=True
    Columns("D:D").EntireColumn.AutoFit
    
End Sub