+ Reply to Thread
Results 1 to 17 of 17

vba excel - loading sheet data into userform using IsEmpty

  1. #1
    Forum Contributor
    Join Date
    02-25-2013
    Location
    Colorado, US
    MS-Off Ver
    Microsoft 365 Apps
    Posts
    518

    vba excel - loading sheet data into userform using IsEmpty

    I'm pretty sure this is basic, but I have a form storing 1 row of data (Table[A2:X2]) to use as a reference for my entire project. The form forces all controls filled before moving data with only option to fill or close workbook. Once data is stored, worksheet change event dates "Y2". The controls need populate only if IsEmpty check on "Y2" is true. Below is my working code, but I'm getting an invalid property value error on form initialization when the table is filled. What am I missing here? Here's what I've been working on but keep getting compile errors.
    Please Login or Register  to view this content.
    Last edited by terriertrip; 10-11-2017 at 04:29 PM.

  2. #2
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,151

    Re: vba excel - loading sheet data into userform using IsEmpty

    Try with
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: vba excel - loading sheet data into userform using IsEmpty

    Any chance you could upload a sample workbook?

    Click on GO ADVANCED, scroll down and click Manage Attachments.
    If posting code please use code tags, see here.

  4. #4
    Forum Contributor
    Join Date
    02-25-2013
    Location
    Colorado, US
    MS-Off Ver
    Microsoft 365 Apps
    Posts
    518

    Re: vba excel - loading sheet data into userform using IsEmpty

    Hi Norie. I've uploaded a parsed down version so it doesn't have the worksheet change event code in the sheet, but if you just put a value in C2 for now to mimic the desired result, that should be enough.

  5. #5
    Forum Contributor
    Join Date
    02-25-2013
    Location
    Colorado, US
    MS-Off Ver
    Microsoft 365 Apps
    Posts
    518

    Re: vba excel - loading sheet data into userform using IsEmpty

    workbook is attached.
    Attached Files Attached Files

  6. #6
    Forum Contributor
    Join Date
    02-25-2013
    Location
    Colorado, US
    MS-Off Ver
    Microsoft 365 Apps
    Posts
    518

    Re: vba excel - loading sheet data into userform using IsEmpty

    porucha vevrku. that seems a bit over thought to me but I'm very new to vba too. It's a form initialization problem. I'm not having any issues with calling the data sources up or once filled, moving data from the form to the sheet - just when I introduce a procedure calling the data back up (if not empty) if it is there.

    EDIT: I've also been able to call the data up with other code I've tested, but then when the range is empty, it errors, so it either works one way or the other and I want it to work both ways.
    Last edited by terriertrip; 10-11-2017 at 05:48 PM.

  7. #7
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,151

    Re: vba excel - loading sheet data into userform using IsEmpty

    1. What is your original filename of WorkBook (name) ?
    You uploaded test.xlsm but in vba code is "msBOOKS"

    2. Error in the definition formula of "State"
    Give up of use Offset and use instead:
    Please Login or Register  to view this content.
    in this case
    Please Login or Register  to view this content.
    is no needed
    Attached Images Attached Images
    Last edited by mjr veverka; 10-11-2017 at 06:33 PM.

  8. #8
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: vba excel - loading sheet data into userform using IsEmpty

    All of the defined names in the workbook are invalid so can't really do much with the workbook - the userform's Initialize event won't even run.

  9. #9
    Forum Contributor
    Join Date
    02-25-2013
    Location
    Colorado, US
    MS-Off Ver
    Microsoft 365 Apps
    Posts
    518

    Re: vba excel - loading sheet data into userform using IsEmpty

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    should be
    Please Login or Register  to view this content.
    sorry about the confusion

  10. #10
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: vba excel - loading sheet data into userform using IsEmpty

    When I make those changes the userform seems to work just fine, the combobox populates as expected and values are saved then the Create button is clicked.

    What exactly is the problem you are having and how can I recreate it?

  11. #11
    Forum Contributor
    Join Date
    02-25-2013
    Location
    Colorado, US
    MS-Off Ver
    Microsoft 365 Apps
    Posts
    518

    Re: vba excel - loading sheet data into userform using IsEmpty

    Sorry about that. I was in a rush, so here's a corrected version.

  12. #12
    Forum Contributor
    Join Date
    02-25-2013
    Location
    Colorado, US
    MS-Off Ver
    Microsoft 365 Apps
    Posts
    518

    Re: vba excel - loading sheet data into userform using IsEmpty

    wb attached. The forum keeps wanting me to log in every time I navigate anywhere.
    Attached Files Attached Files

  13. #13
    Forum Contributor
    Join Date
    02-25-2013
    Location
    Colorado, US
    MS-Off Ver
    Microsoft 365 Apps
    Posts
    518

    Re: vba excel - loading sheet data into userform using IsEmpty

    when I initialize the form again after unloading, the values are not in the control boxes. I want the values to populate the controls (if not empty).

  14. #14
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: vba excel - loading sheet data into userform using IsEmpty

    What values would you expect to see in the userform?

    PS What is the Application.CountA here meant to be checking?
    Please Login or Register  to view this content.

  15. #15
    Forum Contributor
    Join Date
    02-25-2013
    Location
    Colorado, US
    MS-Off Ver
    Microsoft 365 Apps
    Posts
    518

    Re: vba excel - loading sheet data into userform using IsEmpty

    Whatever is entered and saved. I'm thinking the Application.CountA is redundant and in fact probably don't need it since IsEmpty is checking to see if C2 is filled and if is filled, the userform calls the range values.

  16. #16
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: vba excel - loading sheet data into userform using IsEmpty

    This will populate the combobox and put the values from row 2 from Sheet2 on the userform.
    Please Login or Register  to view this content.

  17. #17
    Forum Contributor
    Join Date
    02-25-2013
    Location
    Colorado, US
    MS-Off Ver
    Microsoft 365 Apps
    Posts
    518

    Re: vba excel - loading sheet data into userform using IsEmpty

    Thank you Norie. Much more concise. Works as intended.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Loading information from spread sheet into userform
    By Graeme Smith in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-22-2013, 10:30 PM
  2. Loading and Editing Data from Userform
    By Gazmon in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-30-2013, 07:49 PM
  3. [SOLVED] EXCEL USERFORM- pull data from sheet 1 into userform
    By PANTECH in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-18-2013, 11:10 AM
  4. Userform not loading after mail was send from Excel
    By Cornie in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-23-2012, 09:21 AM
  5. Problem with loading data from a combo box to my sheet
    By Quicksnot in forum Excel General
    Replies: 0
    Last Post: 09-18-2012, 05:04 PM
  6. Loading Excel sheet into Web component
    By Rishi Dhupar in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-24-2006, 11:55 AM
  7. Down loading XL sheet data into the Notepad
    By ssamband in forum Excel General
    Replies: 7
    Last Post: 07-28-2005, 02:06 PM
  8. Excel sheet not loading
    By BurhanM in forum Excel General
    Replies: 1
    Last Post: 06-28-2005, 07:05 AM

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