A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

"Conditional formatting" via VB?



 
 
Thread Tools Display Modes
  #1  
Old August 3rd, 2004, 07:36 PM
Trista
external usenet poster
 
Posts: n/a
Default "Conditional formatting" via VB?

I created a workbook which uses about 3000 cells that have
conditional formatting.

Basically, the cell uses a dropdown and if "A" is chosen,
the cell turns orange, "B" makes it green, "C" makes it
blue. Problem is that when I go to save it, I receive the
message that "Excel could not save all the data and
formatting you recently added to filename.xls" because
excel will not save files with conditional formatting more
than 2050 rows.

So I'm trying to come up with another way to do this. Is
there a visual basic trick to doing so? Unfortunately, I
am not that skilled at vb...

Thanks.
  #2  
Old August 3rd, 2004, 10:06 PM
Tod
external usenet poster
 
Posts: n/a
Default "Conditional formatting" via VB?

You can use the Worksheet Change event.

For example,

'Type A, B or C anywhere on the sheet
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Value = "A" Then
Target.Interior.ColorIndex = 44
ElseIf Target.Value = "B" Then
Target.Interior.ColorIndex = 10
ElseIf Target.Value = "C" Then
Target.Interior.ColorIndex = 5
End If
End Sub

To limit the event to certain cells, try something like:

'Type A, B or C anywhere on the sheet
Private Sub Worksheet_Change(ByVal Target As Range)
Set InRange = Intersect(ActiveSheet.Range("A1:A100"),
Target)
If Not InRange is Nothing then
If Target.Value = "A" Then
Target.Interior.ColorIndex = 44
ElseIf Target.Value = "B" Then
Target.Interior.ColorIndex = 10
ElseIf Target.Value = "C" Then
Target.Interior.ColorIndex = 5
End If
end if
End Sub




-----Original Message-----
I created a workbook which uses about 3000 cells that

have
conditional formatting.

Basically, the cell uses a dropdown and if "A" is chosen,
the cell turns orange, "B" makes it green, "C" makes it
blue. Problem is that when I go to save it, I receive

the
message that "Excel could not save all the data and
formatting you recently added to filename.xls" because
excel will not save files with conditional formatting

more
than 2050 rows.

So I'm trying to come up with another way to do this. Is
there a visual basic trick to doing so? Unfortunately, I
am not that skilled at vb...

Thanks.
.

  #3  
Old August 3rd, 2004, 10:43 PM
Trista
external usenet poster
 
Posts: n/a
Default "Conditional formatting" via VB?

Thank you - works perfectly!
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Carry over conditional formatting Justin Mailmerge 3 May 22nd, 2004 10:41 AM
Greater than formulas with conditional formatting Jamie New Users 1 May 21st, 2004 04:32 AM
Conditional Formatting Questions Andy B Worksheet Functions 1 May 12th, 2004 02:48 PM
Conditional Formatting on a cell that has an IF function DDM Worksheet Functions 0 May 11th, 2004 05:13 PM
MIN value exclude '0' & Conditional Formatting JEM Worksheet Functions 5 April 16th, 2004 03:40 AM


All times are GMT +1. The time now is 05:20 PM.


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