+ Reply to Thread
Results 1 to 8 of 8

Open a excel userform with values previously entered by user using VBA

  1. #1
    Registered User
    Join Date
    01-16-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    12

    Open a excel userform with values previously entered by user using VBA

    I have an excel userform.On filling the values and clicking save , the textbox values are saved to corresponding columns in a excel sheet.On clciking the Open button i want the userform to open with the previously filled values without accessing the excel sheet.I'am a newbie and have no clue about this..Kindly help.Thanks in advance

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Open a excel userform with values previously entered by user using VBA

    It seems that you require some code which should run on Initialization of the Userform and the controls needs to load the last entry from the worksheet.

    Please attach the workbook for providing the code.


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Registered User
    Join Date
    01-16-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Open a excel userform with values previously entered by user using VBA

    this is the form id like to work on...refer sheet 'dd' please[also once the save is clicked,the excel sheet is read only]
    Last edited by anuraag1; 01-18-2013 at 06:23 AM.

  4. #4
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Open a excel userform with values previously entered by user using VBA

    I seen your file and it seems to be lot of conditions needs to be reversed.

    Better on initialize event do something like this...

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    01-16-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Open a excel userform with values previously entered by user using VBA

    works fine...thank you..but here's the problem .i'm storing the list index of the country combo box in the excel sheet,however i need the name of the country on reopening the form in the userform..Then i need the state combobox to populate based on the country chosen.. i do not want the
    If country = "United States" Then
    cmbState1.List() = Sheet2.Range("K1:K92").Value
    End If
    sisnce there are over 200 countries i need an effect and not so lengthy code
    ...Kindly help sixth sense..

  6. #6
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Open a excel userform with values previously entered by user using VBA

    ha ha I am aware of this issue that's why I mentioned

    lot of conditions needs to be reversed
    in my earlier post

    you have to use your select case statement in reverse to identify the Country Name using the code no.

    or

    Keep a base data in a separate sheet (both # and Country Name) and use Vlookup function in your code and get the Value.

  7. #7
    Registered User
    Join Date
    01-16-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Open a excel userform with values previously entered by user using VBA

    but everything involves access to sheet..is there absolutely no way to lock the fields in the form once the OK is pressed and reopen the form with them..

  8. #8
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Open a excel userform with values previously entered by user using VBA

    1) On Ok Click after Data Transfer you SHOULD NOT CLEAR the fields
    2) You should not Exit the UserForm instead just HIDE it.
    3) Even you have done the above the userform will not keep the last entry data when the file is closed and opened. So it requires the Last entry to be feeded into each control on FORM INITIALISATION

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1