If it's not too much trouble.
Could you describe step by step, how to do it.
Because my excel doesn't let to run your macro file
Thanks!
If it's not too much trouble.
Could you describe step by step, how to do it.
Because my excel doesn't let to run your macro file
Thanks!
what version of excel do you have?
i resave the file to 97-2003 format
Sry, my bad. It opened
On thing happened!
When I added some more rebars to Dictionary, it gave me error, because there is already with same key word element
For ex.
How could i fix it in VBA? Perhaps i have to use extra dictionary, ex. rebars2?' 1 rebars rebars.Add 0.28, "1x6" rebars.Add 0.5, "1x8" rebars.Add 0.79, "1x10" rebars.Add 1.13, "1x12" rebars.Add 1.54, "1x14" rebars.Add 2.01, "1x16" rebars.Add 2.54, "1x18" rebars.Add 3.14, "1x20" rebars.Add 3.8, "1x22" rebars.Add 4.91, "1x25" rebars.Add 6.16, "1x28" rebars.Add 8.04, "1x32" rebars.Add 10.18, "1x36" rebars.Add 12.57, "1x40" ' 4 rebars rebars.Add 1.13, "4x6" rebars.Add 2.01, "4x8" rebars.Add 3.14, "4x10" rebars.Add 4.52, "4x12" rebars.Add 6.16, "4x14" rebars.Add 8.04, "4x16" rebars.Add 10.18, "4x18" rebars.Add 12.57, "4x20" rebars.Add 15.21, "4x22" rebars.Add 19.63, "4x25" rebars.Add 24.63, "4x28" rebars.Add 32.17, "4x32" rebars.Add 40.72, "4x36" rebars.Add 50.27, "4x40"
Last edited by Einsener37; 03-15-2023 at 03:56 AM.
Okei i did it as i did in Python
I used String type for key word and I added 0 to the end, example 3.140 and converted string to long so i could compare
But it doesn't help.
I use function CLng, and i rounds it as it wishes and my if statements won't work anymore
Last edited by Einsener37; 03-15-2023 at 04:47 AM.
Perhaps use the '4x28' as the key as they are unique and the numbers as the items?
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.
Could you help me more.
If you run your macro and enter the value, which is already in rebars dictionary , ex 1.57. Then it will give such error
How should code be changed for not to get such error massage?
Thanks!
error2.jpg
See attached.
BTW:
2023-03-17_094356.jpg
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.
Since this thread is apparently not solved I shall remove the "Solved" entitlement
Remember To Do the Following....
Use 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
Then mark the thread as solved Einsener 37.
Remember To Do the Following....
Use 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
Could you help me to modify it a bit.
How does it work with VBA if i want to split the result into different sells? Ex, cross-area, pcs and diameter in different cells.
Capture.jpg
Attached.
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.
Just to understand more
Where have you defined these variables xx, yy, zz?
Capture2.jpg
I haven't.
I took out Option Explicit.
If you must define them:
Dim xx,yy,zz
in the same Listbox_Click 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.
I would like to add one listbox with just opportunity to choose rebar
What am I doing wrong in code, that it gives me error
error3.jpgPublic Sub UserChoice() Dim WS As Worksheet Dim lb2 As MSForms.ListBox Set WS = ThisWorkbook.Worksheets("Sheet1") Set lb2 = WS.OLEObjects("ListBox2").Object lb2.Clear WS.Range("E20").Resize(, 6).ClearContents Dim rebars2 As Scripting.Dictionary Set rebars2 = New Scripting.Dictionary ' 2 rebars rebars2.Add "2x6", 0.57 rebars2.Add "2x8", 1.01 rebars2.Add "2x10", 1.57 rebars2.Add "2x12", 2.26 rebars2.Add "2x14", 3.08 rebars2.Add "2x16", 4.02 rebars2.Add "2x18", 5.09 rebars2.Add "2x20", 6.28 rebars2.Add "2x22", 7.6 rebars2.Add "2x25", 9.82 rebars2.Add "2x28", 12.32 rebars2.Add "2x32", 16.08 rebars2.Add "2x36", 20.36 rebars2.Add "2x40", 25.13 For i = 0 To rebars2.Count - 1 lb2.AddItem rebars2.Items(i) & " - " & rebars2.Keys(i) Next i End Sub
Make it easy for us to help you, supply a workbook with where you've got to so far.
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.