hard queston about vb

  • hi there


    today i have very hard question


    i doubt to find its answer


    anyway i ask but please if u know let me know too


    there is a workbook that located in local network lets call it "confirmation workbook"


    there is another workbook in same location named "refrence",and it contains id's and related datas to id's



    now i want to creat a userform1 in "confirmation workbook",that contain a textbox that i want to user enter an id number,and i want vb goes and searches that id datas in "reffrence workbook",and show related datas in userform1
    ,and soooo


    i want to enter a data for example"confirmed" in text box in userform1 below the information of that searched id,and that "confirmed" sentence enter and save in related id in "reffrence workbook"



    what a hard question!


    do u know how can i do it?


    every help will be appreciated and thanks in advance

  • Re: hard queston about vb


    Which version of Excel?


    How is the data laid out, if it's a table of data then you don't need VBA VLOOKUP works across workbooks without opening the data workbook

  • Re: hard queston about vb


    its excel workbook


    and normal excel data


    how i should change vlookup vb code?



    im using this now :

  • Re: hard queston about vb


    You cannot do that - you could open the workbook containing the worksheet via vba code.

    Code
    Dim wb As Workbook
    Dim ws As Worksheet
    Set wb = Workbooks.Open("C:\Temp\Book2.xlsx")
    Set ws = wb.Worksheets("Mainreport")
    wb.Activate
        If Me.TextBox51.Text <> "" Then
    ....


    However if the value does not exist on VLookUp you will get an error so you will need to use something like

    Code
    On Error Resume Next
    ......
    if err.Number<>0 then
    ....

    Regards
    [SIZE=3]Anthony
    [/SIZE]&WCF_AMPERSAND[SIZE=3]
    [/SIZE]&WCF_AMPERSAND&WCF_AMPERSAND&WCF_AMPERSAND[SIZE=2]You have your way. I have my way. As for the right way, the correct way, and the only way, it does not exist.[/SIZE]




Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!