Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Condtional formatting in VBA help!

I am having trouble with CF in VBA it worked fine under the CF with th
3 arguments that is built in to Excel, the code below was kindl
supplied to me to satisfy other criteria that i needed, please chec
the attatched file which has pictures and a short explanation of ho
and what the CF worked on

Simon

Heres the code!

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim val
Dim fValid As Boolean
On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("I3:AG641")) Is Nothing Then
Do
fValid = False
val = InputBox("Enter Skill Level" & vbCrLf & " 1= In Training"
vbCrLf & " 2= Trained" & vbCrLf & " 3= Can Train Others" & vbCrLf &
4= Delete Colour and Entry" & vbCrLf & "After number entry enter an
letter, " & vbCrLf & "(For option 4 do not enter a letter!)", "Skill
Breakdown and Competencies Entry", "")
If val = "" Then fValid = True
If Len(val) = 2 Then
If Left(val, 1) = 1 Or Left(val, 1) = 2 Or Left(val, 1) = 3 Then
fValid = True
End If
ElseIf Len(val) = 1 Then
If Left(val, 1) = 4 Then fValid = True
End If
If Not fValid Then _
MsgBox "Invalid Entry Try Again!"
Loop Until fValid
With Target
Select Case Left(val, 1)
Case 1:
.Interior.ColorIndex = 48
Case 2:
.Interior.ColorIndex = 41
Case 3:
.Interior.ColorIndex = 43
Case 4:
.Interior.ColorIndex = xlNone
.Value = ""
.Font.Name = "Times New Roman"
Exit Sub
End Select
Select Case Mid(val, 2, 1)
Case Else:
.Value = Mid(val, 2, 1)
.Font.Name = "Wingdings"
End Select
End With
End If

If Intersect(Target, Me.Range("I3:AG641"), ActiveCell.Offset(0, 36)
"") Then
ActiveCell = Selection.ColorIndex = 3
ElseIf Intersect(Target, Me.Range("I3:AG641"), ActiveCell.Offset(0, 36
= ("I$2" * 365) = Today()) Then
ActiveCell = Selection.ColorIndex = 4
ElseIf Intersect(Target, Me.Range("I:AG641"), ActiveCell.Offset(0, 36
= ("I$2" * 365) < Today()) Then
ActiveCell = Selection.ColorIndex = 5
End If

ws_exit:
Application.EnableEvents = True
End Sub

The if statements at the bottom here are what ive been trying to write
as i said if it did work it would only look at cell I$

Attachment filename: cf help.xls
Download attachment: http://www.excelforum.com/attachment.php?postid=53861
--
Message posted from http://www.ExcelForum.com

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
Condtional formatting in Excel Eán[_2_] Excel Worksheet Functions 1 September 16th 08 03:08 PM
Condtional formatting in Excel Eán[_2_] Excel Discussion (Misc queries) 1 September 16th 08 02:23 PM
Condtional Formatting bollard Excel Worksheet Functions 2 April 24th 08 03:16 PM
Condtional Formatting PAL Excel Worksheet Functions 11 January 3rd 08 07:34 PM
Condtional formatting 68magnolia71 Excel Worksheet Functions 2 April 15th 05 09:46 PM


All times are GMT +1. The time now is 03:25 AM.

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"