+ Reply to Thread
Results 1 to 8 of 8

VBA range not populating correctly

  1. #1
    Registered User
    Join Date
    01-24-2011
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    31

    Exclamation VBA range not populating correctly

    Please Login or Register  to view this content.
    The code is above. For whatever reason it comes up with an error for the workbook when trying to check this function. Workbook is included. This code can be found in form "ShiftPop"

    I used it exactly like I use range every time, although normally I don't have a for...next and if in the middle of it.

    I can change the name range just keep in mind it is dynamic. The pivot table range I use for a sheet I didn't attach. I was just borrowing since it should be essentially the same range. I tried naming a new range and it didn't fix anything.


    The function of it should be:

    Any number of events, volunteers, and shifts have been entered using the forms. The "Populated Shifts" sheet is basically a large raw data sheet that other things are calculated based on. When using ShiftPop it will enter the data on a new row for every person. The problem trying to be solved is that sometimes you forget what data you have entered and not entered. So it should check that the exact shift you have entered with each volunteer is not in the "Populated Shifts" already. It should check for each volunteer listed in the combo boxes.

    If anything is unclear let me know.

    Thanks
    Attached Files Attached Files
    Last edited by Squirrel; 09-12-2011 at 11:41 AM.

  2. #2
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: VBA range not populating correctly

    Hi Squirrel, it seems (to me at least) that
    Please Login or Register  to view this content.
    is where the error is being thrown. Where is
    Please Login or Register  to view this content.
    I see the worksheet named event but no range named event.

    EDIT: The error gets thrown in the initialization of the userform.
    If you're happy with someone's help, click that little star at the bottom left of their post to give them Reps.

    ---Keep on Coding in the Free World---

  3. #3
    Registered User
    Join Date
    01-24-2011
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    31

    Re: VBA range not populating correctly

    That error is because there is no data in the form. Add a dummy event and volunteer for it to work correctly.

    The range formulas can be found when you look for the Names box in excel.
    Last edited by Squirrel; 09-09-2011 at 05:05 PM.

  4. #4
    Registered User
    Join Date
    01-24-2011
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    31

    Re: VBA range not populating correctly

    I have added a test event and volunteer. Populate Shift is the button in question. Any help is appreciated. Same code and problem.
    Attached Files Attached Files

  5. #5
    Valued Forum Contributor
    Join Date
    08-29-2011
    Location
    Mississauga, CANADA
    MS-Off Ver
    Excel 2010
    Posts
    503

    Re: VBA range not populating correctly

    Hi,
    Please find the attached workbook it is working good.
    I have commented the old code lines that were replaced and prefixed them with "Kelshaer" so they will be easy to search for them.
    Please let me know how it works and mark the thread as "SOLVED" if it was
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    01-24-2011
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    31

    Re: VBA range not populating correctly

    Thanks.

    The error isn't showing up but the code itself doesn't work. In the block of code from above, the point would be that any time you tried to input the exact same data.. IE Same event, Same person, and same times (and only when all 3 conditions are met) then it will kick back with a MsgBox and not add the info.

    Could you take a look?

  7. #7
    Valued Forum Contributor
    Join Date
    08-29-2011
    Location
    Mississauga, CANADA
    MS-Off Ver
    Excel 2010
    Posts
    503

    Re: VBA range not populating correctly

    please find the attached.
    the duplicate test wasnt working on the original file
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    01-24-2011
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    31

    Re: VBA range not populating correctly

    Great it looks like it will work. Thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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