Results 1 to 16 of 16

How to repeat a macro in multiple rows of a sheet?

Threaded View

  1. #1
    Registered User
    Join Date
    06-24-2013
    Location
    Texas
    MS-Off Ver
    MS Office 2007
    Posts
    17

    Question How to repeat a macro in multiple rows of a sheet?

    Howdy,

    I'm new to the board and new to VBA programming, but I think this should be a very simple questions. The code below works for row 5 of my sheet, but I would like it to work on every subsequent row in the sheet (for like 1000 rows). I assume I need a dim loop, but I can't get it to work. Thanks in advance for the help!


    Private Sub Worksheet_Change(ByVal Target As Range)
    Application.EnableEvents = False

    If [B5] = "Startup" Then
    [F5, I5:K5].Interior.ColorIndex = 3
    Worksheets("Input Log").Range("F5, I5:K5").ClearContents

    Else
    [F5, I5:K5].Interior.ColorIndex = 0
    End If

    If [B5] = "Shutdown" Then
    [D5:E5].Interior.ColorIndex = 3
    Worksheets("Input Log").Range("D5:E5").ClearContents

    Else
    [D5:E5].Interior.ColorIndex = 0
    End If

    If [I5] = "Catalyst Malfunction" Or [I5] = "" Then
    [M5].Interior.ColorIndex = 0

    Else
    [M5].Interior.ColorIndex = 3
    Worksheets("Input Log").Range("M5").ClearContents
    End If

    Application.EnableEvents = True
    End Sub
    Last edited by rgoodman; 07-01-2013 at 09:08 AM.

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