+ Reply to Thread
Results 1 to 12 of 12

Looping Issue

  1. #1
    Registered User
    Join Date
    01-06-2015
    Location
    Dallas, TX
    MS-Off Ver
    10
    Posts
    35

    Looping Issue

    I have a workbook with multiple sheets, each sheet is of varying length but all have the same header layout from columns A:E. I am trying to add a formula to column F that starts in cell F3. The formula written manually would be =A3=A2. I need the vba to find the last row of the worksheet using column A as a guide, then autofill the formula from cell F3 to the bottom of the data. Then I need it to move to the next worksheet and repeat this process through the rest of the work book. For some reason the Next is not working and instead of repeating the formula on the next worksheet it just stays on the first worksheet.

    Thanks for the help.

    Please Login or Register  to view this content.
    Last edited by sparkyster; 02-27-2018 at 12:55 PM.

  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,691

    Re: Looping Issue

    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 here



    This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    01-06-2015
    Location
    Dallas, TX
    MS-Off Ver
    10
    Posts
    35

    Re: Looping Issue

    Sorry about that, I was unaware of the rule. I'll make sure I do this going forward on all posts. The original request should be ok now to answer per your instruction.

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

    Re: Looping Issue

    You're inside a With block so maybe dots(!) the problem:

    Please Login or Register  to view this content.
    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

  5. #5
    Registered User
    Join Date
    01-06-2015
    Location
    Dallas, TX
    MS-Off Ver
    10
    Posts
    35

    Re: Looping Issue

    Thanks Xladept, that got the formula to stop on the first worksheet, but when it moved to the second worksheet resulted in Run time erro '1004, Autofill method of range class failed

    When I hit debug, the error showed here:

    Please Login or Register  to view this content.
    Any idea?

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

    Re: Looping Issue

    It worked for me with no hiccups - can you:Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

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

    Re: Looping Issue

    On second thought, I'll bet that your "second" sheet is protected

  8. #8
    Registered User
    Join Date
    01-06-2015
    Location
    Dallas, TX
    MS-Off Ver
    10
    Posts
    35

    Re: Looping Issue

    I've attached an example of the desired result with notes on the issue. The VBA you helped with is listed and can be run to identify the error I'm getting. Appreciate the help.
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    01-06-2015
    Location
    Dallas, TX
    MS-Off Ver
    10
    Posts
    35

    Re: Looping Issue

    Quote Originally Posted by xladept View Post
    On second thought, I'll bet that your "second" sheet is protected
    I haven't protected any of the worksheets, unless it's happening without me knowing about it.

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

    Re: Looping Issue

    Hi sparkyster,

    The code is missing the one dot shown in red:

    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    01-06-2015
    Location
    Dallas, TX
    MS-Off Ver
    10
    Posts
    35

    Re: Looping Issue

    That was it! Thanks for the help!

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

    Re: Looping Issue

    You're welcome and thanks for the rep!

+ 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. Looping Issue
    By sparkyster in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-31-2018, 12:59 PM
  2. Odd macro looping issue
    By mattmickle in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-28-2015, 04:16 PM
  3. Looping issue
    By wani in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-30-2012, 02:23 AM
  4. Need help with looping issue
    By SDBoca in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-08-2011, 08:18 PM
  5. Performance issue - Looping through Cells
    By dljdirect in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-13-2011, 06:32 PM
  6. Bizarre VBA Looping issue...
    By valverde311 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-10-2011, 04:25 PM
  7. Looping issue
    By davidm in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-08-2005, 01:58 PM

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