+ Reply to Thread
Results 1 to 5 of 5

code works running in visual basic editor but not when running from Excel macro

  1. #1
    Registered User
    Join Date
    09-20-2013
    Location
    las vegas, Nevada
    MS-Off Ver
    Excel 2003
    Posts
    4

    code works running in visual basic editor but not when running from Excel macro

    I've spent hours "googleing" and trying to troubleshoot this with no luck. The following code works great running from within visual basic editor but not when running from Excel macro. I suspect may be mixing up the use of objects & properties. I hope there may be someone in this group that can help and I thank you in advance to looking at this!


    Please Login or Register  to view this content.
    Last edited by alansidman; 11-06-2016 at 03:08 PM. Reason: code tags added

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

    Re: code works running in visual basic editor but not when running from Excel macro

    Code Tags Added
    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found at http://www.excelforum.com/forum-rule...rum-rules.html



    (I have added them for you today. Please take a few minutes to read all Forum Rules and comply in the future.)
    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 xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: code works running in visual basic editor but not when running from Excel macro

    Try adding to this line:

    Please Login or Register  to view this content.
    You don't have the dots in the first with block and you've commented out the others
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  4. #4
    Registered User
    Join Date
    09-20-2013
    Location
    las vegas, Nevada
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: code works running in visual basic editor but not when running from Excel macro

    I see what you're pointing out. Maybe looking at this more simplistically would help.
    The 1st "with" block runs in debug but just seems to bypass the code when running from the Excel macro.
    As I'm working with multiple workbooks, I think I would prefer an object approach and avoid using activations and or selections.



    Please Login or Register  to view this content.

  5. #5
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: code works running in visual basic editor but not when running from Excel macro

    What I was saying is that you're not using the dot operator

+ 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. Macro has errors if Visual Basic Editor is not open
    By Whizbang in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-22-2022, 03:09 PM
  2. The Code Window in the Visual Basic Editor of Excel
    By Marilyaryott in forum Tips and Tutorials
    Replies: 0
    Last Post: 03-23-2012, 10:31 PM
  3. Visual basic Editor in Excel 2007
    By vijayiitbbs in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-07-2011, 11:58 AM
  4. [SOLVED] Visual basic Code or editor won't load in Excel
    By johnsday in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-02-2006, 02:10 PM
  5. [SOLVED] Can I run Visual Basic procedure using Excel Visual Basic editor?
    By john.jacobs71 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-26-2005, 10:25 AM
  6. Visual Basic Editor for Excel
    By JoeABC in forum Excel General
    Replies: 1
    Last Post: 08-11-2005, 11:05 PM
  7. [SOLVED] When you edit a macro in visual basic editor, why doesn't it upda.
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-08-2005, 01:06 PM
  8. Running an excel macro within Visual basic
    By pkrono in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-10-2005, 05:03 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