Posts by slapman

    Re: Getting a cell value displayed in textbox from Combox


    Quote from StephenR;787900

    We don't need to see actual dta, dummy data will do.


    sorry
    i just cannot.


    i figured some codding for second part but im getting : end if without block if , why?


    Re: Getting a cell value displayed in textbox from Combox


    I will elaborate my problem and hope you guys can help me.


    i have in A UserForm : 1 X combo box , 2x Textboxes


    Combox is populting values from another sheet :


    Code
    Private Sub UserForm_Initialize() 
     Me.CB1.List = Worksheets("s5").Range("a2:a342").Value
    End Sub


    when i choose a value in the combo box #1 textbox will show its value.
    that is being done using :

    Code
    Private Sub CB1_Change()
    Dim name As String
    name = CB1.Value
    Value = Application.WorksheetFunction.VLookup(name, S5.Range("A2:F341"), 5, False)
    Me.textm1.Value = Format(Value, ".00")
    End Sub


    The other textbox (called textm2) is for the End User to type in a diffrent value to change, if he would like to ,when observing the value given from Textbox1 (textm1).


    Now....


    As im populating values to combo box from

    Code
    Worksheets("s5").Range("a2:a342")

    and showing values from E2:E342 using Vlookup

    Code
    Value = Application.WorksheetFunction.VLookup(name, S5.Range("A2:F341"), 5, False)

    The problem is:


    How to populate The user input From textbox2 (=textm2) , 3 columns (="H2:H342") after the values populated from "E2:E342" in textbox1 , According to the selected Value from combox and place it the the correct row and the correct column.

    Re: Getting a cell value displayed in textbox from Combox


    update :


    solved issue 1 using vlookup in vba code


    Code
    Private Sub CB1_Change()Dim name As String
     name = CB1.Value
    Value = Application.WorksheetFunction.VLookup(name, S5.Range("A2:F341"), 5, False)
    Me.textm1.Value = Value
    End Sub

    Re: Getting a cell value displayed in textbox from Combox


    thx stephenR , but it doesnt work - nothing happens , looks like its not what i need.


    let me be more clear.


    textbox1 = show the actual value of the selected item from combo box. so if i chose J26 (located in A59) i will get its value 16.9 (located in E59)


    textbox2 = the user which uses the sheet maybe would like to currect the number (from 16.9) to what ever he wants to add , the number he will insert will be copied to cell H59.


    hope thats better.

    Hey ,


    I have created a small userform with 1 combo box 2 textboxes.


    the combobox displaying range of values from a given range:


    Code
    Private Sub UserForm_Initialize()  
    Me.CB1.List = Worksheets("s5").Range("a2:a342").Value
    End Sub



    one text box should display the value from the current cell which selected by the listbox.


    second text box is using as an input box to place a value in the next column.


    for example : i choose in list box (values at a2:a342) the value "J26" , textbox1 (values at e2:e342) will show current value for J26 which is 16.9 , textbox2 will be used by the user to enter a value that will be copied to a cell in column h (values will be implant at H2:H342)


    hope i explained myself correctly , ill any appriciate help for it


    thanks alot.

    Re: flag empty value in textbox


    carim another maybe simple issue i have here


    i also now have textbox1 to textbox14 to add values which supposed to do the same action , and now plant the values the column before ( s1.Cells(i, 5)) how to do this?


    i thought i could do by same idea only call another variable with negative value - but it wont work on the line i marked *****


    Hello again.


    I need the ability to search in current active sheet S/n which i enter in a textbox sitting in the top of the current activesheet.
    data sheet called "S2".
    all S/N located at A6:A50000



    User using the sheet will input S\N in the TextBox ("txtsearch") and will click a command button to search.


    result should be: vba code will find the S/n
    1. if there is a match , will prompt "match found" with msg box
    2. after click Ok on msg box , vba code will give focus on the found cell.


    if nothing found: simple msg box with : "no s/n found".


    so far i got this but im lost with debbuger saying things like " out of range" , "overflow" everytime im trying .
    hope you guys can help me again.



    Re: flag empty value in textbox


    Quote from Carim;786780

    Crazy runtime can be related to many issues ... including the size of your workbook, the complexity of your userform, etc ....


    Take a look at the ten tip to speed up your macros ...


    http://datapigtechnologies.com…d-up-your-excel-vba-code/


    carim!
    thank you for all your help so far
    i used the Application.Calculation = xlCalculationManual


    and its now works flawlessly.


    ill do few more tests and will update. thanks again!

    Re: flag empty value in textbox


    dont know why but its not working.
    if i leave every textbox empty and just press the Updateb1_Click() then all the targeted cells turns to 0
    also these targetd cells wont update even if i put in number bigger then 0.

    Re: flag empty value in textbox


    the revised code now wont give any debugger error but it put the computer into loop and eventualy allow the target cells here (s1.Cells(i, 6)) to change to blank or 0 incase all textboxes (43-56) are left blank or 0


    Re: flag empty value in textbox


    whish i could post my workbook i cant for confidentiality reasones


    any ways ,debugger indicates on the "****" line i marked :


    Re: flag empty value in textbox



    I revised the cmd button to that above.


    still getting that error


    [ATTACH=CONFIG]71554[/ATTACH][ATTACH=CONFIG]71555[/ATTACH]


    excuse me for my Noobiness

    Re: flag empty value in textbox


    carim thank you so much for helping me again.



    and got:


    [ATTACH=CONFIG]71553[/ATTACH]


    what im doing wrong?

    Re: flag empty value in textbox


    Quote from Carim;786674

    It would seem you have tackled a new issue ...no ???


    Have you sorted out the issue related to preventing users from adding spaces in their inputs ???


    hey carim , that was never the issue, maybe i failed to explain myself better.


    My finale issue im dealing now is to "check" the textboxes to see that all of them have any value <0 (= No blanks in the textboxes) while im pressing command button that supposed to unload the form.


    "PrivateSub Updateb1_Click() "


    i made that command button unavaliable but i need a code that check all the boxes i have from TextBox43 to Textbox56 with value >0 then allow command button to be available to unload the form while during this action Cells updating with
    the values entered in the text boxes.

    Re: flag empty value in textbox


    my problem is that my update button will change cells values according what entered inside the textboxes. thats only thing it will do


    i need a sulotion to prevent that update button to be active if any of the textboxs containing blanks


    code per textbox (there are 20-30 boxes):



    thats the code for the command button:


    Re: flag empty value in textbox


    thank you carim!
    only thing not resolved is that blank is acceptable
    there is any case that can be filled into the code that will prevent blank?
    or another procedureshould be added?