Consulting

Results 1 to 19 of 19

Thread: filter and sum values based on three selection from dropdown

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    filter and sum values based on three selection from dropdown

    hello
    i try finding code show data when i select from e1,f1,g1 and sum values the lastrow this is what i got but doesn't work
    PHP Code:
    Sub AAA()    Dim R As Range   
     Dim DataRange 
    As Range   
     Dim Total 
    As Double   
     Dim TheYear 
    As String    
    Dim TheMonth 
    As String    
    Dim Theitem 
    As String       ' get your values from the linked cells.    
    TheYear = Range("A1").Value   
     TheMonth = Range("F1").Value    
    Theitem = Range("G1").Value      
     Set DataRange = Worksheets("INV").Range("A1:D10") '
    << CHANGE   
     
    For Each R In DataRange.Columns(1).Cells        
    If R(11).Value TheYear Or LCase(Trim(TheYear)) = "ALL" Then           
     
    If R(12).Value TheMonth Or LCase(Trim(TheMonth)) = "ALL" Then              
      
    If R(13).Value Theitem Or LCase(Trim(Theitem)) = "ALL" Then                    
    Total 
    Total R(14).Value          
          End 
    If           
     
    End If        
    End If    
    Next R    
    MsgBox Total
    End Sub 
    thanks in advance
    Attached Files Attached Files
    Last edited by maghari; 11-19-2020 at 02:55 AM.

Posting Permissions

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