Results 1 to 20 of 36

Thread: Count Data Then Send To Correct List

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #31
    I used this before and with your code Charlize we can get the count, it's just getting the counts to the sheets before sending.
    Private Sub cmdCreateTable_Click()
        Dim strHead As String
        Dim strSheetName As String
        Dim strListAddress As String
        Sheets(1).Range("A1:A163").Select
        strHead = Selection.Cells(1, 1)
        strSheetName = "'" & ActiveSheet.Name & "'!"
        strListAddress = Selection.Address(ReferenceStyle:=xlR1C1)
        ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _
        strSheetName & strListAddress).CreatePivotTable TableDestination:="", TableName:="CountOf"
        ActiveSheet.PivotTables("CountOf").AddFields RowFields:=strHead
        With ActiveSheet.PivotTables("CountOf").PivotFields(strHead)
            .Orientation = xlDataField
            .Caption = "Count of" & strHead
            .Function = xlCount
            ' End With
            ActiveWorkbook.ShowPivotTableFieldList = False
            Application.CommandBars("PivotTable").Visible = False
        End With
    End Sub
    Thanking you for your support and time

    Nurofen
    Last edited by Nurofen; 11-06-2007 at 12:02 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •