Results 1 to 2 of 2

Formatting conditional columns with macros

Threaded View

  1. #1
    Registered User
    Join Date
    08-31-2009
    Location
    washington, dc
    MS-Off Ver
    Excel 2003
    Posts
    55

    Formatting conditional columns with macros

    Hello,


    I am trying to create a macros that will shade all cells in column "E" that has "0" or is blank, in each worksheet. I used this macros below but for some reason it is not working...it will run without errors but nothing will happen....


    Sub DoBlankCells()
    
      Dim Cell As Range
      Dim RegExp As Object
      Dim Rng As Range
      Dim Wks As Worksheet
     
        Set RegExp = CreateObject("VBScript.RegExp")
        RegExp.Global = False
        RegExp.IgnoreCase = True
        RegExp.Pattern = "^0.*"
     
          For Each Wks In ActiveWorkbook.Worksheets
            Set Rng = Wks.Range("E1", Wks.Cells(Rows.Count, "E").End(xlUp))
              For Each Cell In Rng
                If RegExp.Test(Cell) = True Then
                   Cell.EntireColumn.Interior.Pattern = xlSolid16
                End If
              Next Cell
          Next Wks
     
        Set RegExp = Nothing
     
    End Sub





    any suggestions?

    Thank you in advance for your help!
    Last edited by copleyr; 09-18-2009 at 08:53 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