+ Reply to Thread
Results 1 to 18 of 18

Populate Form Macro Changing Formulas on Other Sheets

  1. #1
    Forum Contributor
    Join Date
    03-12-2019
    Location
    USA
    MS-Off Ver
    2010
    Posts
    421

    Populate Form Macro Changing Formulas on Other Sheets

    Hello,

    Something weird is happening and I cannot figure out what it is. When I enter another AFR# on my AFRsInput sheet in cell D4 it populates that form by the Populate Form macro. For some reason the formulas on the 'AuthorizedFieldReturn' and the 'PartsRequisition' sheets get a bunch of REF#.

    I changed the formulas to correct them but each time I select another AFR# in cell D4 of the AFRsInput sheet it goes back to the REF# on those sheets.

    Can someone please help to fix this ?

    Thank you so much,

    Fred

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Populate Form Macro Changing Formulas on Other Sheets

    You don't say which cells show #REF errors. It is difficult to run your code because my first try it told me "invalid AFR number" and I don't know how to make a valid one.

    Anyway, it looks like your errors occur in the Parts Used During Repair area. This is because your code deletes the contents of the table Table 1 on the AFRsInput sheet, triggering the reference error. Use clearing instead of deleting:
    Please Login or Register  to view this content.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Contributor
    Join Date
    03-12-2019
    Location
    USA
    MS-Off Ver
    2010
    Posts
    421

    Re: Populate Form Macro Changing Formulas on Other Sheets

    The AFR# list is in the AFRsDB sheet sorry for not mentioning.

  4. #4
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,262

    Re: Populate Form Macro Changing Formulas on Other Sheets

    The AuthorizedFieldReturn' and the 'PartsRequisition' sheets have formulas that reference the Parts Table...

    When you change [D4] the sheet event fires and deletes that table rendering your formulas invalid
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  5. #5
    Forum Contributor
    Join Date
    03-12-2019
    Location
    USA
    MS-Off Ver
    2010
    Posts
    421

    Re: Populate Form Macro Changing Formulas on Other Sheets

    I tried that and fixed the formulas on the PartsRequisition sheet.

    Then I entered another AFR# in the AFRsInput sheet cell D4 and the formulas went back to REF# errors.

  6. #6
    Forum Contributor
    Join Date
    03-12-2019
    Location
    USA
    MS-Off Ver
    2010
    Posts
    421

    Re: Populate Form Macro Changing Formulas on Other Sheets

    Sintek,

    Do I need to reference the AFRsParts instead? That is where they are stored for each AFR#.

  7. #7
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,262

    Re: Populate Form Macro Changing Formulas on Other Sheets

    You are limiting yourself to no entries with pre-populated formulas
    Populate this part "Parts Used During Repair" at the same time as you update your table...

  8. #8
    Forum Contributor
    Join Date
    03-12-2019
    Location
    USA
    MS-Off Ver
    2010
    Posts
    421

    Re: Populate Form Macro Changing Formulas on Other Sheets

    I am not sure what you mean. I am attempting to generate reports to print out for the Parts Requistion and AFRs.


  9. #9
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,262

    Re: Populate Form Macro Changing Formulas on Other Sheets

    Something like this....Also I would not use a loop ...I suggest filtering and copying the entire range to the table and other sheets...
    Please Login or Register  to view this content.

    EDit...Another issue...the below range is limited to 15 rows...What happens when there are more than 15 entries...
    Untitled.png
    Last edited by sintek; 04-06-2019 at 08:18 AM.

  10. #10
    Forum Contributor
    Join Date
    03-12-2019
    Location
    USA
    MS-Off Ver
    2010
    Posts
    421

    Re: Populate Form Macro Changing Formulas on Other Sheets

    Okay I tried your edit of the code. What happens now is the previous parts number of rows gets blanked out but the table remains with those blank rows. The next AFR parts will start at the end of those blank rows on the AFRsInput sheet. Also it takes quite a while for code to run vs before.

  11. #11
    Forum Contributor
    Join Date
    03-12-2019
    Location
    USA
    MS-Off Ver
    2010
    Posts
    421

    Re: Populate Form Macro Changing Formulas on Other Sheets

    I didn't see your edit. The maximum parts per AFR will be 30. We will never have more than that. Usually less than 10 parts per AFR.

  12. #12
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,262

    Re: Populate Form Macro Changing Formulas on Other Sheets

    The next AFR parts will start at the end of those blank rows on the AFRsInput sheet
    Don't clear the table...keep as it was...delete...

    Why are you first populating this Parts Table and then having the other 2 sheets referenced from the Table...
    Why not just update the sheets immediately

  13. #13
    Forum Contributor
    Join Date
    03-12-2019
    Location
    USA
    MS-Off Ver
    2010
    Posts
    421

    Re: Populate Form Macro Changing Formulas on Other Sheets

    I agree with immediately. When an AFR# is placed in cell D4 the report sheets should also reference that number immediately. But how?

  14. #14
    Forum Contributor
    Join Date
    03-12-2019
    Location
    USA
    MS-Off Ver
    2010
    Posts
    421

    Re: Populate Form Macro Changing Formulas on Other Sheets

    Perhaps I should use an Index Match on the report sheets to reference the AFRsDB and AFRsParts sheets instead of the AFRsInput sheet.

  15. #15
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,262

    Re: Populate Form Macro Changing Formulas on Other Sheets

    Play around with this....As an example
    Also...Merged cells is a no no...Only causes unnecessary issues
    Please Login or Register  to view this content.

  16. #16
    Forum Contributor
    Join Date
    03-12-2019
    Location
    USA
    MS-Off Ver
    2010
    Posts
    421

    Re: Populate Form Macro Changing Formulas on Other Sheets

    I have editing to do to remove the merged cells.

    Thank you for the help sintek.

  17. #17
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,262

    Re: Populate Form Macro Changing Formulas on Other Sheets

    With the code in Post 15...From the filter one can easily populate both your required sheets... which does away with the formula references and the Table...
    Just need to add rng3 and copy to the other sheet as well...Will have a look later when I return to see if you managed to implement...

  18. #18
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,262

    Re: Populate Form Macro Changing Formulas on Other Sheets

    Sort out your merged cells...Redesign your forms to make coding simpler...
    Play around with this...
    Please Login or Register  to view this content.

    I suggest look into Userforms and try and steer clear from sheet formulas and sheet event manipulation...
    Attached Files Attached Files

+ 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. [SOLVED] Populate Form Macro When No Should Clear Form
    By fredfarmer in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-28-2019, 09:52 AM
  2. Replies: 6
    Last Post: 07-26-2015, 09:00 PM
  3. populate list in form multiple work sheets based on a criteria
    By Kelly Linton-Selkirk in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-21-2015, 04:00 PM
  4. Populate Web Form with macro
    By Pedro Rodrigues in forum Excel General
    Replies: 2
    Last Post: 08-15-2014, 09:34 AM
  5. [SOLVED] Urgent Help Needed To auto populate my form using formulas (With sample attached)
    By pringle1987 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-15-2013, 11:15 PM
  6. Cant figure out how to populate a form from multiple sheets
    By kmraz in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-09-2013, 02:44 PM
  7. macro user form populate sheet
    By johncrofts in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-28-2011, 05:22 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