Consulting

Results 1 to 8 of 8

Thread: Call data from another sheet based on multi critiria

  1. #1
    VBAX Regular
    Joined
    Apr 2018
    Posts
    20
    Location

    Call data from another sheet based on multi critiria

    Dear All

    kindly find attached workbook have 2 sheets
    1st sheet is as database
    2nd sheet is for analysis


    required

    call data from database sheet to analysis sheet based on the criteria and condition in the sheet

    thanks

    Attachment :
    Call Data.xls

  2. #2
    VBAX Regular
    Joined
    Apr 2018
    Posts
    20
    Location
    any help ????

  3. #3
    VBAX Regular
    Joined
    Apr 2018
    Posts
    20
    Location
    any help ??

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Not with as sparse a description as that and no sample workbook.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  5. #5
    VBAX Regular
    Joined
    Apr 2018
    Posts
    20
    Location
    I cant understand you my friend

  6. #6
    VBAX Regular
    Joined
    Apr 2018
    Posts
    20
    Location
    Any Help Guys ????????

  7. #7
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,728
    Location
    Try this

    Option Explicit
    
    Sub Calls_Click()
        Dim rData As Range, rFilters As Range
        Dim wsAnalysis As Worksheet
        Dim iDatabase As Long, iAnalysis As Long, i As Long
        
        Application.ScreenUpdating = False
        
        Set rData = Worksheets("Database").Cells(1, 2).CurrentRegion
        Set wsAnalysis = Worksheets("Analysis")
        Set rFilters = wsAnalysis.Range("B1:D10")
        
        With wsAnalysis
            Range(.Rows(12), Rows(.Rows.Count)).ClearContents
        End With
        
        iAnalysis = 12
        
        '   1      2      3          4           5         6       7      8   9
        'Period  Type    Date    Category    Description Amount  Marker  Tag Ref
        For iDatabase = 2 To rData.Rows.Count
            '3 Type
            '4 Date C-D
            '5 Category
            '6 Description
            '7 Amount
            '8 Marker
            '9 Tag
            '10 Ref
            With rData.Rows(iDatabase)
            
                For i = 2 To 10
                    Select Case i
                        Case 1, 3, 5, 6, 7, 8, 9, 10
                            If Len(rFilters.Cells(i, 2).Value) > 0 And .Cells(i - 1).Value <> rFilters.Cells(i, 2).Value Then GoTo GetNext
                        Case 2, 4
                            If Len(rFilters.Cells(i, 2).Value) > 0 And .Cells(i - 1).Value < rFilters.Cells(i, 2).Value Then GoTo GetNext
                            If Len(rFilters.Cells(i, 3).Value) > 0 And .Cells(i - 1).Value > rFilters.Cells(i, 3).Value Then GoTo GetNext
                    End Select
                Next i
            
                .Copy wsAnalysis.Cells(iAnalysis, 2)
                iAnalysis = iAnalysis + 1
            End With
    
    GetNext:
        Next iDatabase
        Application.ScreenUpdating = True
    
    End Sub
    Attached Files Attached Files
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  8. #8
    VBAX Regular
    Joined
    Apr 2018
    Posts
    20
    Location

    Red face

    Dear Paul_Hosslerthank you very much for your support iam very thankfulwhats your opinion if i make anew sheet as shart of account , we will make for each category a number then we can filter with 2 criteria Is it right ????Thankskero

Posting Permissions

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