Results 1 to 5 of 5

Using IF to restart macro when cell is a particular value

Threaded View

Carlsbergen Using IF to restart macro... 03-15-2010, 03:51 AM
Carlsbergen Re: Using IF to restart macro... 03-15-2010, 04:20 AM
Marcol Re: Using IF to restart macro... 03-15-2010, 04:25 AM
Marcol Re: Using IF to restart macro... 03-15-2010, 04:35 AM
Carlsbergen Re: Using IF to restart macro... 03-19-2010, 09:29 AM
  1. #1
    Registered User
    Join Date
    05-12-2009
    Location
    Udevalla, Sweden
    MS-Off Ver
    Excel 2007
    Posts
    85

    Using IF to restart macro when cell is a particular value

    Hi.

    Sorry for the bad thread title but I didnt know what else to write

    Anyway, here is my problem.
    I have a macro that runs through a bunch of external .xls files based on a list in my primary workbook.
    What I want to do happen is that if I put an "x" in the adjacent cell of my list, the macro should change a cell value and then go to the next item in the list.

    My code is becoming quite big so I wont post all of it but I think this will be enough.
    The blablablabla lines shows where I have omitted some code

    Do
    
    'Defines the name of the file for running external macro
    Dim sName As String
        sName = ActiveCell.Value
    
    blablabla
    
    If ActiveCell.Offset(0, -1).Value = "x" Then
    Sheets("S01-01-0103").Select
        Range("B3").Select
        ActiveCell.Offset(0, Sheets("Macros").Range("G1") + 1).Select
        ActiveCell.Offset(-1, 0).Select
        ActiveCell.Value = sName
    
        Sheets("Macros").Range("G1") = Sheets("Macros").Range("G1") + 1
        
        Sheets("Macros").Select
        Range("F1") = Range("F1") + 1
        
        ActiveCell.Offset(1, 0).Select
    
       Else
         
    End If
    
    
    blablalblalbla
    
    
    'Loops this macro until the list is empty
    Loop Until IsEmpty(ActiveCell.Offset(0, 0))

    All I want to know is what do I write after
    ActiveCell.Offset(1, 0).Select
    for the macro to restart, in other words, go back to "Do".
    I have everything else working fine,
    Last edited by Carlsbergen; 03-15-2010 at 04:17 AM. Reason: Corrected error

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