PDA

View Full Version : Solved: Colour entire row



marshybid
06-06-2008, 07:50 AM
Hi All,

Friday afternoon and I have to get somethiong finished, hoping someone can help.

I currently have the following code as part of a macro



Set myBaseWorkSheet = ActiveWorkbook.ActiveSheet
Set myBaseRange = myBaseWorkSheet.Rows
For RowsCounter = myBaseRange.Rows.Count To 2 Step -1
Set myBaseRow = myBaseRange.Item(RowsCounter)
If Len(myBaseRow.Cells.Item(1, 8)) <> 0 Then
'// Delete data that we do not need for each tab
If myBaseRow.Cells.Item(1, 1) <> "Y" Then
myBaseRow.Delete
End If
End If
Next


I want to replace the myBaseRow.Delete statement with myBaseRow. Interior colour green for example.

I don't know the syntax.

Thanks in advance

Marshybid

mdmackillop
06-06-2008, 08:03 AM
myBaseRow.interior.colorindex = 4
or
myBaseRow.entirerow.interior.colorindex = 4

marshybid
06-06-2008, 08:11 AM
Thanks MD,

I was trying myBaseRow.Interior.Color = 35

I will mark this thread as solved

Marshybid :bow:

Bob Phillips
06-06-2008, 08:26 AM
myBaseRow.Interior.Color = vbred

marshybid
06-06-2008, 08:45 AM
myBaseRow.Interior.Color = vbred


Hi xld,

I had no idea you could use this method to determine the color. I assume from this that vbgreen, vbblue etc would alos all work the same.

Thanks for this, I always learn something new each time I receive help on this site (which is quite often, as you know)

Thanks,

marshybid :hi:

mdmackillop
06-06-2008, 08:49 AM
But when I try this
Cells(1, 1).Interior.Color = vbSkyBlueWithATouchOfOrange
I get Black :devil2:

marshybid
06-06-2008, 08:59 AM
But when I try this
Cells(1, 1).Interior.Color = vbSkyBlueWithATouchOfOrange
I get Black :devil2:

MD, I'm far more interested in how you ever worked that out :rotlaugh:

Whatever possessed you to try it out.... I love it :bow:

Have a good week end all.

Marshybid :hi:

Bob Phillips
06-06-2008, 09:15 AM
But when I try this
Cells(1, 1).Interior.Color = vbSkyBlueWithATouchOfOrange
I get Black :devil2:

That is because whenever you see a Sky Blue With A Touch Of Orange, it is symptomatic that you have hit the hard stuff too much, it is late in the evening, and in reality, everything is black.

See, there is a simple answer for everything.

mdmackillop
06-06-2008, 09:22 AM
:beerchug:
Well it's that time of day, and a pint of Abbot is waiting for me!

Bob Phillips
06-06-2008, 09:26 AM
:beerchug:
Well it's that time of day, and a pint of Abbot is waiting for me!

London Pride here ... hic!

marshybid
06-06-2008, 09:34 AM
London Pride here ... hic!

Mine will be a large JD on the rocks followed by a Whale Ale. :beerchug:

Enjoy