If Cells Are A Color Then Error

Ark68

Well-known Member
Joined
Mar 23, 2004
Messages
4,564
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I have this line of code, part of an If/Else/Endif process
VBA Code:
             If Not Intersect(Target, .Range("E" & rwend + 2 & ":E" & rwend + 5)) Is Nothing Then
                MsgBox segtar.Address
                With ws_form
                    .Unprotect
                    If segtar.Cells.Interior.indexcolor = xlNone Then
                        segtar.Cells.Interior.Color = ccgreen
                        segtar.Cells.Font.Color = RGB(0, 32, 96)
                        RemoveCellSelectionBox
                    Else
                        Target.Interior.Color = ccgreen
                        Target.Font.Color = RGB(0, 32, 96)
                        RemoveCellSelectionBox
                    End If
                    .Protect
                End With
            End If

The line in red leaves me with an error: "Object doesn't support this property or method."

Variable 'segtar' declared as range and equals the target range. The worksheet in unprotected.
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Guessing that it's the 2nd IF that is causing the problem as it should be colorindex
 
Upvote 0
Solution
Lol ... instead of indexcolor? This gal needs to wake up!
Thank you.
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,560
Messages
6,125,523
Members
449,236
Latest member
Afua

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top