+ Reply to Thread
Results 1 to 4 of 4

VBA Issue: Code only runs halfway than stops.

  1. #1
    Registered User
    Join Date
    02-02-2012
    Location
    Canada
    MS-Off Ver
    Excel 2013
    Posts
    42

    VBA Issue: Code only runs halfway than stops.

    Hello,

    So I created a small application here is what it does: (Please dont be scared by the length of this post I am just writing in extreme detail to avoid confusion.) Also note that I commented out and had to remove some sections (You'll get what I mean once you see the workbook) to make the workbook under the 1MB file limit.

    1. User opens form
    2. User checks off all the checkboxes that refer to the drawings they want to add. (Open the form and this will make more sense)
    3. They add the line number for each box and the qty for each box.
    4. The hit add parts
    5. The code in the MatForm runs
    6. It duplicates preset sheets and renames them based on the captions of the checkboxes checked.
    7. Than it adds material qtys to the "CutList" sheet again absed on the checkbox caption of checked off cehck boxes.

    This works perfectly right now. Except for two things:
    1. I get an error message every time it trys copying a sheet that is as follows:
    "The name 'MAT' already exists. Click Yes to use that version of the name , or click No to rename the version of 'MAT' you're moving or copying"

    2. All of the checkboxes from APF512MN to APF524MN only work halfway. They will add the new sheet and rename it but they wont add anything to the"CutList"

    I have been over this code 100 times and maybe Im blind but I cant see where I went wrong. Im sure its a typo somewhere but I cant find it! so if someone can find my mistake it would be awesome!

    Also if you're going through and you think hey he could do this in a much simpler way by all means PLEASE let me know ! Any way I can simplify is apprecated.


    Things you may need to know:

    I'm using excel 2013
    All the global variables are stored in a module called: GlobalVars
    All the code is stored in the code section of "MatForm"

    To Run this as it is supposed to run:
    1.Open the workbook,
    2.Go to the "CutList Sheet"
    3.Click the "CutList Generator" Button (orange button)
    4. Go to the "NAAMS" Tab (ignore the rest they are for other purposes)
    5. Go to the "Fence" Tab than the "MM" Tab
    6. Check off some check boxes and enter random number values in the txtboxes beside them
    7. Click "Add Parts" to see what it does and how it works.

    Heres the workbook.
    NAAMS FENCE JOB MAKER FOR EXCELFORUM.xlsm
    Last edited by TomToms; 10-14-2014 at 08:29 AM.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,888

    Re: Cant find where I went wrong in this Workbook.

    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution.

    Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.

    To change a Title go to your first post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.

    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Cant find where I went wrong in this Workbook.

    The first part is not really an error - it's just Excel telling you that you are copying a sheet with a defined name. You can suppress that using:
    Please Login or Register  to view this content.
    The MN checkboxes work fine for me in that sample.
    Remember what the dormouse said
    Feed your head

  4. #4
    Registered User
    Join Date
    02-02-2012
    Location
    Canada
    MS-Off Ver
    Excel 2013
    Posts
    42

    Re: VBA Issue: Code only runs halfway than stops.

    @ alansidman : my apologies, I just wasn't sure how to name the post to reflect my issue. I have renamed it to something more descriptive. Does this work?

    @romperstomper Thankyou so much, i will use that, it was getting super annoying to hit yes 20 times in a row on popup messages.

+ 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. Sorry if this is a wrong Topic, but can't find the right one... :(
    By david gonzalez in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 12-26-2013, 07:18 AM
  2. Find Products code - what's wrong with it
    By Foreverlearning in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 03-05-2012, 11:09 PM
  3. what's wrong with this find formula
    By tryer in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-22-2010, 04:06 PM
  4. Macro is closing wrong workbook before going to the next workbook
    By curbster in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-12-2009, 05:36 PM
  5. [SOLVED] New WorkBook Macro Looking to WRONG WorkBook
    By Corey in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-29-2006, 05:40 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