+ Reply to Thread
Results 1 to 7 of 7

Excel Macro Acts Differently on Different Computers, even with same version

  1. #1
    Registered User
    Join Date
    01-20-2011
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Excel Macro Acts Differently on Different Computers, even with same version

    Hi all.

    I have developed this macro that is supposed to create a new worksheet titled "Histogram". First, it will delete any worksheet already named histogram, and then go on to build the new histogram/worksheet. Unfortunately, on some computers, it will get as far as deleting the histogram, and then just stop, while it works flawlessly on other computers. Any help or ideas to resolve would be greatly appreciated!

    Here's a snippet of the code through the error:

    Please Login or Register  to view this content.
    Last edited by dbaft; 01-24-2011 at 08:06 AM.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Excel Macro Acts Differently on Different Computers, even with same version

    Welcome to the forum, dbaft.

    The first thing to do is to take out the On Error Resume Next, so you can see where the code breaks.

    It may be because those computers don't have a reference set to atpvbaen.xlam (which itself limits the code to Excel 2007+).

    Please take a few minutes to read the forum rules, and then edit your post to add CODE tags.

    Thanks.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    01-20-2011
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Excel Macro Acts Differently on Different Computers, even with same version

    My apologies. I have never posted to a forum before, but I appreciate your patience

    Unfortunately, it is not my computer that is the issue, but my client's computer, which I will only have limited access to (the reason I was hoping there was some obvious thing in the code to resolve the issue beforehand). If this code will only work in excel 2007+, then it is of no use to me anyway

    Forgive me for being a nuisance, but I am a little new to this. Is there a way to point to the right reference within the VBA code?
    Last edited by dbaft; 01-23-2011 at 05:05 AM.

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Excel Macro Acts Differently on Different Computers, even with same version

    If you set the reference on your computer, then send the workbook to someone else the reference should travel with the workbook

    You would also need to add code to determine which version of excel is in use so that the correct addin is called. I'm not entirely sure what tht line is supposed to do.

    Remove the error handler as Shg suggests & then post back with the error message that is generated
    Last edited by royUK; 01-23-2011 at 05:21 AM.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  5. #5
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Excel Macro Acts Differently on Different Computers, even with same version

    1. Why allowing a user to perform something that isn't allowed/possible ?
    You'd better prevent this so the code
    Please Login or Register  to view this content.
    isn't necessary

    2. Why deleting a sheet, that you need later on ?
    Instead of deleting/creating you could test whether that sheet exists and if not create it.

    3. Avoid select and activate in VBA:
    Please Login or Register  to view this content.
    This code performs nothing and can be omitted
    Please Login or Register  to view this content.
    can be replaced by :
    Please Login or Register  to view this content.
    Last edited by snb; 01-24-2011 at 08:27 AM.



  6. #6
    Registered User
    Join Date
    01-20-2011
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Excel Macro Acts Differently on Different Computers, even with same version

    So it turns out they didn't have the analysis toolpak add-in......guess that should've been my FIRST question....

    I appreciate your help in simplifying my code!!! Learned something new

  7. #7
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Excel Macro Acts Differently on Different Computers, even with same version

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

+ 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