+ Reply to Thread
Results 1 to 3 of 3

Excel Macro Visual Basic code not looking at all sheets with second section of code.

  1. #1
    Registered User
    Join Date
    08-20-2012
    Location
    South Africa
    MS-Off Ver
    Excel 2003
    Posts
    16

    Excel Macro Visual Basic code not looking at all sheets with second section of code.

    I have a section of code that does not look at all sheets when it runs the second section of the code. It runs correct with the first section and when it runs the second section it only looks at sheet1 and ignores the other sheets. When it moves to the next file it runs correct again with the first section of the code and on second section it only looks at sheet1 again. I need this code to look at all sheets every time. I have attached the current files I'm using to test this and I have marked my problem in red where it should have looked at all the sheets like in the sections above it.

    Please Login or Register  to view this content.
    Thank you.
    Attached Files Attached Files

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643
    Why aren't you using the loop variable wshLoop in the second For loop?

    In that loop you only refer to bk.Worksheets(1) which is the first worksheet in the workbook you just opened.

    Actually, why do you have 2 loops?

    As far as I can see they are identical.
    Last edited by Norie; 05-10-2014 at 07:49 AM.
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    08-20-2012
    Location
    South Africa
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: Excel Macro Visual Basic code not looking at all sheets with second section of code.

    O.o wow how could I miss that?

    Thank you I had a brain fart lol.

+ 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. Excel Visual Basic Macro code stops working
    By LPChester in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-04-2013, 07:56 AM
  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. Excel 2007 : Excel Combo-box Visual Basic Code
    By daibao in forum Excel General
    Replies: 3
    Last Post: 08-18-2010, 02:35 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] How do I hide my Visual basic code in Excel?
    By geoffc in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-07-2005, 08:07 AM

Tags for this Thread

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