Consulting

Results 1 to 14 of 14

Thread: List box error 308

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

    List box error 308

    Dear all

    kindly iam facing a problem with listbox 14 coloumn getting its values from text boxes
    suddenly code stops in line Nr# 10

    file attached

    My project - 2.xlsb
    thanks in advance for your help

  2. #2
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,876
    Don't use .additem
    Prepare an array first then assign it to the .list of the listbox:
    Sub CommandButton1_Click()
    ' Error Resume Next
    Dim arr1, i As Long
    Dim arr2(0 To 0, 0 To 13)
    arr1 = Array("tb10", "tb10", "TB0", "tb1", "cb1", "cb2", "tb5", "tb4", "tb10", "tb10", "tb10", "tb6", "tb7", "tb8")
    For i = 0 To UBound(arr1)
      arr2(0, i) = arr1(i)
    Next i
    ListBox1.List = arr2
    '' For Each Ctrl In Me.Controls
    ''    If TypeName(Ctrl) = "TextBox" Or TypeName(Ctrl) = "ComboBox" Then Ctrl.Value = ""
    '' Next Ctrl
    TB0.Value = Format(Worksheets("setup").Range("H2"), "MM/YYYY")
    End Sub
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  3. #3
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,876
    If you have sought help on this topic from other forums, you need (it's a rule) to supply links to those other threads. See http://www.excelguru.ca/content.php?184
    Have you cross posted this question here: https://www.excelforum.com/excel-pro...ml#post5031904?

    By the way, it's the same rule there too.

  4. #4
    VBAX Regular
    Joined
    Apr 2018
    Posts
    20
    Location
    Hello P45Cal

    than you very much for your help appreciate your support , sorry for cross posting
    i will add it to my project and i look for your help if i face any problem
    thanks

  5. #5
    VBAX Regular
    Joined
    Apr 2018
    Posts
    20
    Location
    Marked As Solved

  6. #6
    VBAX Regular
    Joined
    Apr 2018
    Posts
    20
    Location
    Hello P45Cal

    when i try to add more data and press next it replace the old data with new data !!!

    i need to add more data every time i press next till i press post all data in list box 1 move to worksheet("Database") thats it
    can you help me please with both code

    Thanks

  7. #7
    VBAX Regular
    Joined
    Apr 2018
    Posts
    20
    Location
    any one can help ?

  8. #8
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,059
    Location
    You have the array dimmed 0 to 13 which only allows 14 sets of data. Increase the Array to allow additional data
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  9. #9
    VBAX Regular
    Joined
    Apr 2018
    Posts
    20
    Location
    dear Aussiebear
    i cant understand you

    can you change the code and try , my problem is i need when i press Next , all data move to list box , and again when i press next , all data move to list box till finally when i press post all data move to work sheet "Database "

    thanks

  10. #10
    VBAX Mentor 大灰狼1976's Avatar
    Joined
    Dec 2018
    Location
    SuZhou China
    Posts
    479
    Location
    Please refer to the attachment. but "POST" has problems, there is no listobjects on sheets("DATABASE").
    Attached Files Attached Files

  11. #11
    VBAX Regular
    Joined
    Apr 2018
    Posts
    20
    Location
    Dear 大灰狼1976

    thanks for your help , next key is working thanks

    post key code is not working i attached my tries to fix it , i deleted my tries and attached it again ,

    thanks
    Attached Files Attached Files

  12. #12
    VBAX Mentor 大灰狼1976's Avatar
    Joined
    Dec 2018
    Location
    SuZhou China
    Posts
    479
    Location
    Can you explain how to use tb10 data?
    Will it be used in the formula?
    The B/C/J columnS in the appendix is formula.

  13. #13
    VBAX Regular
    Joined
    Apr 2018
    Posts
    20
    Location
    Quote Originally Posted by 大灰狼1976 View Post
    Can you explain how to use tb10 data?
    Will it be used in the formula?
    The B/C/J columnS in the appendix is formula.

    you are awesome , sure this columns has formula i set the Tb10 as test to test the list box with 14 column
    if you please can make it auto evaluated or to keep it with formula as you like
    i just set the tb10 as test not to be used
    " now you understand my project all of it "

    note
    1- column L - the J.v Number it will be auto number ( max + 1 ) every " Journal voucher " - J.V - will be auto serial
    2- column M will be " Yes " Or " No"
    3- the reference number will be changed if you want to change the marker in to " To Be Allocated " and the values equal Zero then the reference will be ( Max + 1 ) - I Can Explain it Later

    Really thanks

  14. #14
    VBAX Regular
    Joined
    Apr 2018
    Posts
    20
    Location
    Hello Every Body

Posting Permissions

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