Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DarkSun (Programmer) Please Reply

Status
Not open for further replies.

missprogrammer

Programmer
Nov 7, 2000
20
US
The column count will differ for each sheet(possibly evertime its ran)


Private Sub Check()
Call ChangeColor(1, 10)
End Sub

Private Sub ChangeColor(MyCol As Integer, MaxRows As Long)
For i = 1 To MaxRows
If ActiveSheet.Cells(i, MyCol).Value = &quot;&quot; And ActiveSheet.Cells(i, MyCol).Interior.ColorIndex <> 1 Then
ActiveSheet.Cells(i, MyCol).Interior.ColorIndex = 3
End If
Next i
End Sub

 
So?

I just gave you the sub to change the color of the cells. You just need to pass the column number and Max rows to it.

Do you know how to get the column numbers?
 
So I think working with your code. If x is the first column then you want to change color in next three columns so you run this.


Call ChangeColor(x+1,100)
Call ChangeColor(x+2,100)
Call ChangeColor(x+3,100)

Where 100 is the number of rows you want to check.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top