Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default Require second qualifier in attached code

Excel 2003; SP2
Got the following from this NG yesterday. Works great.
While testing determined one extra step needed.
Column C has some yellow cells in it, indicating unlocked cells.
(In this application: Unlocked is alway yellow. Yellow always means
unlocked.
It indicates to the users what cells they can manipulate.)

They are NOT to be over-colored by the green.
I call it over-coloured since if the criterial is changed so that the green
is removed, those specifc cells "revert back" to yellow.

Is there a way to "by-pass" the unlocked (yellow) cells in the following?

Dim ws As Worksheet
Set ws = Worksheets("Pricing")
Dim ILastRow As Long

ILastRow = ws.Range("B:B").SpecialCells(xlCellTypeLastCell).R ow
With ws.Range("C6:C" & ILastRow)
.Select
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, Formula1:="=($B6=""*"")"
.FormatConditions(1).Interior.ColorIndex = 4
End With
ws.Range("C6").Select

End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default Require second qualifier in attached code

maybe something like

dim c as range

for each c in ws.Range("C6:C" & ILastRow).cells
if not c.locked then
'add validation
end if
next c




--
Tim Williams
Palo Alto, CA


"BEEJAY" wrote in message ...
Excel 2003; SP2
Got the following from this NG yesterday. Works great.
While testing determined one extra step needed.
Column C has some yellow cells in it, indicating unlocked cells.
(In this application: Unlocked is alway yellow. Yellow always means
unlocked.
It indicates to the users what cells they can manipulate.)

They are NOT to be over-colored by the green.
I call it over-coloured since if the criterial is changed so that the green
is removed, those specifc cells "revert back" to yellow.

Is there a way to "by-pass" the unlocked (yellow) cells in the following?

Dim ws As Worksheet
Set ws = Worksheets("Pricing")
Dim ILastRow As Long

ILastRow = ws.Range("B:B").SpecialCells(xlCellTypeLastCell).R ow
With ws.Range("C6:C" & ILastRow)
.Select
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, Formula1:="=($B6=""*"")"
.FormatConditions(1).Interior.ColorIndex = 4
End With
ws.Range("C6").Select

End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default Require second qualifier in attached code

Tim:
Thanks for the response.
I've played around with this for quite some time and cannot get things to
work.
In the meantime, I've started to wonder if it would make more sense to do
the opposite namely format only the locked cells.
Would this be any easier to code?

"Tim Williams" wrote:

maybe something like

dim c as range

for each c in ws.Range("C6:C" & ILastRow).cells
if not c.locked then
'add validation
end if
next c




--
Tim Williams
Palo Alto, CA


"BEEJAY" wrote in message ...
Excel 2003; SP2
Got the following from this NG yesterday. Works great.
While testing determined one extra step needed.
Column C has some yellow cells in it, indicating unlocked cells.
(In this application: Unlocked is alway yellow. Yellow always means
unlocked.
It indicates to the users what cells they can manipulate.)

They are NOT to be over-colored by the green.
I call it over-coloured since if the criterial is changed so that the green
is removed, those specifc cells "revert back" to yellow.

Is there a way to "by-pass" the unlocked (yellow) cells in the following?

Dim ws As Worksheet
Set ws = Worksheets("Pricing")
Dim ILastRow As Long

ILastRow = ws.Range("B:B").SpecialCells(xlCellTypeLastCell).R ow
With ws.Range("C6:C" & ILastRow)
.Select
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, Formula1:="=($B6=""*"")"
.FormatConditions(1).Interior.ColorIndex = 4
End With
ws.Range("C6").Select

End Sub




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
I require code to run a macro dependant on the date Marie Bayes Excel Discussion (Misc queries) 7 January 15th 07 03:48 PM
I require some help with a section of the following code. tracks via OfficeKB.com Excel Programming 12 December 9th 06 02:22 AM
I REQUIRE SOME HELP WITH CODE tracks via OfficeKB.com Excel Programming 2 November 10th 06 09:01 PM
Copy Worksheet without VB code attached? Chris McFarland Excel Programming 0 June 23rd 04 07:54 PM
Is there a quick way to see which objects have code attached? Terri[_4_] Excel Programming 2 September 12th 03 05:11 PM


All times are GMT +1. The time now is 06:08 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"