Results 1 to 14 of 14

Thread: Resolved(Sorry Again Please Advise on this)

  1. #1
    Hyperactive Member
    Join Date
    Nov 04
    Location
    San Isidro
    Posts
    322

    Thumbs up Resolved(Sorry Again Please Advise on this)

    can you help me make a work around for this problem

    i have two combo box in sheet 1
    1. For Pal Line
    2. For Transaction Level

    all values in pal line and transaction values is generated in
    Sheet 2 as my database

    see attached screenshot of my sheets.

    how can i fill the range of all PAL line Colums in my Pal Line combo bOx
    as well as fill the range of the transaction within the Pal Line?

    for Example PAl Line 1 has 2 transactions
    and Pal Line 2 has 1 transaction

    so if user's choose Pal Line 1 value in the PAL lIne combo box
    only two transactions will appear in the Transaction Level combo box

    help me..
    Attached Images Attached Images  
    Last edited by VBcielle; Jan 13th, 2009 at 09:50 PM. Reason: Resolved
    I want to learn more
    grace

  2. #2
    PowerPoster
    Join Date
    Dec 04
    Posts
    18,523

    Re: Sorry Again Please Advise on this

    in the click or change event for pal line change the listfill range of transaction level to suit, or if you are not using a fill range add the appropiate items to to the combobox
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  3. #3
    Hyperactive Member
    Join Date
    Nov 04
    Location
    San Isidro
    Posts
    322

    Re: Sorry Again Please Advise on this

    thanks sorry for the late reply..how about for the transaction combo box?
    i want to fill the Transaction base on the no. of transaction in the Pal line..

    for ex. in the image above Pal line 1 have transaction 1,2,3
    while Pal Line 2 have only transaction 1...any workaround?
    I want to learn more
    grace

  4. #4
    Hyperactive Member
    Join Date
    Nov 04
    Location
    San Isidro
    Posts
    322

    Re: Sorry Again Please Advise on this

    Ok so to additem in Transaction comboBox i put this code in the change event of the Pal combo box
    is this the right code?

    Code:
    LC = Sheet17.Cells.Find(what:="Transaction", after:=cmbValue, SearchOrder:=xlByColumns, SearchDirection:=xlPrevious).Value
    I want to find all transactions using combo value in the change event..

    for example PAL line 1 has 3 transaction i only want to display Transaction 1, Transaction 2, Transaction 3..

    Please help
    I want to learn more
    grace

  5. #5
    Super Moderator Hack's Avatar
    Join Date
    Aug 01
    Location
    Searching for mendhak
    Posts
    58,283

    Re: Sorry Again Please Advise on this

    Quote Originally Posted by VBcielle
    I want to find all transactions using combo value in the change event..
    Typically I use the click event of a control rather than its Change event.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    I dont answer coding questions via PM or EMail. Please post a thread in the appropriate forum section.

    Creating A Wizard In VB.NET
    Paging A Recordset
    What is wrong with using On Error Resume Next
    Good Article: Language Enhancements In Visual Basic 2010
    Upgrading VB6 Code To VB.NET
    Microsoft MVP 2005/2006/2007/2008/2009/2010/2011/2012/Defrocked

  6. #6
    PowerPoster
    Join Date
    Dec 04
    Posts
    18,523

    Re: Sorry Again Please Advise on this

    try like
    vb Code:
    1. Private Sub ComboBox1_Click()
    2. dim c as range
    3. ComboBox2.Clear
    4.  
    5. If ComboBox1.Text = "a" Then
    6.     For Each c In Range("b1:d1")
    7.     ComboBox2.AddItem c.Value
    8.     Next
    9. ElseIf ComboBox1.Text = "b" Then
    10.     For Each c In Range("f1:g1")
    11.     ComboBox2.AddItem c.value
    12.     Next
    13. End If
    14. End Sub
    where the range in each case contains the transactions fort the appropriate pal line
    or you could find the pal line then loop through until you reach the next pal line
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  7. #7
    Hyperactive Member
    Join Date
    Nov 04
    Location
    San Isidro
    Posts
    322

    Re: Sorry Again Please Advise on this

    Thanks for the reply...Transactions in each Pal could be more than 3...you know it's changing... I want to know the end of range of Transactions..
    I want to learn more
    grace

  8. #8
    Hyperactive Member
    Join Date
    Nov 04
    Location
    San Isidro
    Posts
    322

    Re: Sorry Again Please Advise on this

    Code:
    Sub testPalLIne()
    'JIL
    Call TestFindAll("Pal Line 1")
    End Sub
    I have this code below find first the Pal Line then next transaction but I cannot terminate adding of transaction until Found cells for Pal Line is not equal to the combo value..please help..

    Code:
    Public Sub TestFindAll(cmbValue As Variant)
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    ' TestFindAll
    ' This is a test procedure for FindAll.
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''    
        Dim SearchRange As Range
        Dim FoundCells As Range
        Dim FoundCell As Range
        Dim FindWhat As Variant
        Dim MatchCase As Boolean
        Dim LookIn As XlFindLookIn
        Dim LookAt As XlLookAt
        Dim SearchOrder As XlSearchOrder
        
        Dim SearchRange1 As Range
        Dim FoundCells1 As Range
        Dim FoundCell1 As Range
        Dim FindWhat1 As Variant
        Dim MatchCase1 As Boolean
        Dim LookIn1 As XlFindLookIn
        Dim LookAt1 As XlLookAt
        Dim SearchOrder1 As XlSearchOrder
    
        ''''''''''''''''''''''''''
        'Find First All Pal Line
        '''''''''''''''''''''''''''    
    
        Set SearchRange = Sheet17.Range("A4:IV4")
        FindWhat = "Pal"
        LookIn = xlValues
        LookAt = xlPart
        SearchOrder = xlByColumns
        MatchCase = False
        
        '''''''''''''''''''
        ' Search the range.
        '''''''''''''''''''    
    Set FoundCells = FindAll(SearchRange:=SearchRange, FindWhat:=FindWhat, _
            LookIn:=LookIn, LookAt:=LookAt, SearchOrder:=SearchOrder, MatchCase:=MatchCase)
            
        ''''''''''''''''''''''''''
        'Second Find All Transaction
        '''''''''''''''''''''''''''    
    
       Set SearchRange1 = Sheet17.Range("A4:IV4")
           
        FindWhat1 = "Transaction"
        LookIn1 = xlValues
        LookAt1 = xlPart
        SearchOrder1 = xlByColumns
        MatchCase1 = False
        
        '''''''''''''''''''
        ' Search the range.
        '''''''''''''''''''    
    Set FoundCells1 = FindAll2(SearchRange:=SearchRange1, FindWhat:=FindWhat1, _LookIn:=LookIn1, LookAt:=LookAt1, SearchOrder:=SearchOrder1, MatchCase:=MatchCase1)
        
        ''''''''''''''''''''''
        ' Display the results.
        '''''''''''''''''''''' 
    
        For Each FoundCell In FoundCells.Cells 'Find Pal lines
         If FoundCell.Text = cmbValue Then ' If Found cell equal to comboValue     
           For Each FoundCell1 In FoundCells1.Cells 'Find All Transactions        
        Do
             ActiveSheet.ComboBox2.AddItem FoundCell1.Text
            Loop Until (FoundCell <> cmbValue) 'Add Transaction Until Find Pal Lines not equal to cmbValue       
    Next FoundCell1
    
        End If
       Next FoundCell
    
        
    End Sub
    Last edited by VBcielle; Jan 13th, 2009 at 08:38 PM.
    I want to learn more
    grace

  9. #9
    PowerPoster
    Join Date
    Dec 04
    Posts
    18,523

    Re: Sorry Again Please Advise on this

    vb Code:
    1. 1.
    2.       Private Sub ComboBox1_Click()
    3.       dim c as range, fnd as boolean
    4.       ComboBox2.Clear
    5.        myrng = range("a1:a99")      ' row with pal lines and transactions, however many columns you want
    6.          for each c in myrng
    7.                if fnd then
    8.                        if left(c.value, 8)  = "pal line" then    ' found next pal line so finish
    9.                             exit for
    10.                        else combobox2.additem c.value
    11.                        end if
    12.                else
    13.                if c.value = combobox1.text then fnd = true  ' find pal line cell to match combo 1
    14.                end if
    15.          next
    16.  
    17.        End Sub

    i didn't test any of this, make sure next pal line matches for case etc e&oe

    if you were searching the entire sheet, then i would use find to start, but as i believe you know which line the pal and transaction are in i just work with that
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  10. #10
    Hyperactive Member
    Join Date
    Nov 04
    Location
    San Isidro
    Posts
    322

    Re: Sorry Again Please Advise on this

    hello Thanks again for the help...i tested you code in a macro button and it appears like this
    Attached Images Attached Images  
    Last edited by VBcielle; Jan 13th, 2009 at 09:19 PM.
    I want to learn more
    grace

  11. #11
    Hyperactive Member
    Join Date
    Nov 04
    Location
    San Isidro
    Posts
    322

    Re: Sorry Again Please Advise on this

    Left code is case sensitive i just change "pal line" to "Pal Line" thanks agaiin..this one is resoveld
    I want to learn more
    grace

  12. #12
    Hyperactive Member
    Join Date
    Nov 04
    Location
    San Isidro
    Posts
    322

    Re: Resolved(Sorry Again Please Advise on this)

    can i ask a little more..how can i get the column count of the last transaction for example Pal Line 1 which is transaction 3 ?
    I want to learn more
    grace

  13. #13
    PowerPoster
    Join Date
    Dec 04
    Posts
    18,523

    Re: Resolved(Sorry Again Please Advise on this)

    try this one
    vb Code:
    1. Private Sub ComboBox1_Click()
    2.       dim c as range, fnd as boolean
    3.       ComboBox2.Clear
    4.        myrng = range("a1:a99")      ' row with pal lines and transactions, however many columns you want
    5.          for each c in myrng
    6.                if fnd then
    7.                        if left(c.value, 8)  = "pal line" then    ' found next pal line so finish
    8.                             msgbox "last transaction line for " & combobox1.text & " is in column " & c.column
    9.                             exit for
    10.                        else combobox2.additem c.value
    11.                        end if
    12.                else
    13.                if c.value = combobox1.text then fnd = true  ' find pal line cell to match combo 1
    14.                end if
    15.          next
    16.  
    17.        End Sub

    or
    combobox2.listcount
    depending what you want
    Last edited by westconn1; Jan 14th, 2009 at 12:46 AM.
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  14. #14
    Hyperactive Member
    Join Date
    Nov 04
    Location
    San Isidro
    Posts
    322

    Re: Resolved(Sorry Again Please Advise on this)

    thanks again for the help.
    I want to learn more
    grace

Posting Permissions

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