PDA

View Full Version : List box error 308



kero4000
12-23-2018, 05:40 AM
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

23458
thanks in advance for your help

p45cal
12-23-2018, 03:31 PM
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
12-23-2018, 03:44 PM
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-programming-vba-macros/1256885-fill-listbox-from-textbox-2.html#post5031904?

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

kero4000
12-24-2018, 12:05 AM
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 :hi:
thanks

kero4000
12-26-2018, 03:58 AM
Marked As Solved :yes

kero4000
12-27-2018, 01:32 PM
Hello P45Cal

when i try to add more data and press next it replace the old data with new data !!! :crying:
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

kero4000
12-29-2018, 06:20 AM
any one can help ?

Aussiebear
12-29-2018, 08:33 PM
You have the array dimmed 0 to 13 which only allows 14 sets of data. Increase the Array to allow additional data

kero4000
12-30-2018, 12:54 AM
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

大灰狼1976
01-01-2019, 08:14 PM
Please refer to the attachment. but "POST" has problems, there is no listobjects on sheets("DATABASE").

kero4000
01-02-2019, 03:36 AM
Dear 大灰狼1976

thanks for your help , next key is working thanks :hi:

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

thanks

大灰狼1976
01-02-2019, 07:47 PM
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.

kero4000
01-03-2019, 12:45 AM
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 : pray2:

Really thanks :rotlaugh:

kero4000
01-09-2019, 01:50 AM
Hello Every Body