+ Reply to Thread
Results 1 to 5 of 5

Stop Macro from running after certain row?

  1. #1
    Registered User
    Join Date
    11-16-2012
    Location
    college park, maryland
    MS-Off Ver
    Excel 2010
    Posts
    37

    Stop Macro from running after certain row?

    Hello I am trying to use a macro that links data from one sheet in a workbook to another sheet, and drags the formula across the rows.
    Currently I have my macro repeating to the final row in the sheet, but I would like it to stop at at specific row. for example row 74.
    Here is the code I am using:

    Please Login or Register  to view this content.
    I am using Excel 2010. Please help

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Stop Macro from running after certain row?

    Maybe change this line:

    For i = 6 To FinalRow

    To this line:

    For i = 6 To 74

  3. #3
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Stop Macro from running after certain row?

    John is correct. Another option would be to put an If statement within the loop which checks the current row of "i". If it is >73 you would exit the sub. Depending on what you wanted to do this could be more useful or more of a hinderance.

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Stop Macro from running after certain row?

    Balston: FinalRow = Cells(Rows.Count, 1).End(xlUp).Row
    is wrong. You have 1 instead of l in (xlUp)

    Try this one

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    11-16-2012
    Location
    college park, maryland
    MS-Off Ver
    Excel 2010
    Posts
    37

    Re: Stop Macro from running after certain row?

    Thanks so much for all your answers! I actually just tried putting
    Final row= 74 and it worked! Go figure.

+ 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