![]() |
Whats wrong with this!!!!!
hey guys, i got a problem
i am using colours to trigger events in my code, everything works fine apart from the event triggered by green, heres my code: If Weekday(Now()) = vbWednesday Then For Each CellWed In RngWed If WorksheetFunction.IsNumber(CellWed.Value) And CellWed.Value <= 17.59 And CellWed.Font.Color < RGB(255, 0, 0) And CellWed.Font.Color < RGB(0, 255, 0) And CellWed.Font.Color < RGB(0, 0, 255) Then CountEmp = CountEmp + 1 ElseIf CellWed.Font.Color = RGB(255, 0, 0) Then CountHalfDay = CountHalfDay + 1 ElseIf CellWed.Value = "Holiday" Then CountHoliday = CountHoliday + 1 ElseIf CellWed.Font.Color = RGB(0, 255, 0) Then CountSickHD = CountSickHD + 1 ElseIf CellWed.Value = "Sick" Then CountSick = CountSick + 1 ElseIf CellWed.Value = "A/A" Or CellWed.Value = "A\A" Then CountAabsence = CountAabsence + 1 ElseIf CellWed.Font.Color = RGB(0, 0, 255) Then CountAabsenceHD = CountAabsenceHD + 1 ElseIf CellWed.Value = "U/A" Or CellWed.Value = "U\A" Then CountUnabsence = CountUnabsence + 1 ElseIf CellWed.Value = "S/U" Or CellWed.Value = "S\U" Then CountSuspend = CountSuspend + 1 End If Next CellWed i know what you may be thinking i am selecting the wrong font colour green, just to let you know i am selecting the green that is 4 columns in from the left and one row down on the excel colour palette, funnily enough the one tagged "green" both the blue and red work fine. why does this code not work? please help!! The Noob. |
Whats wrong with this!!!!!
there are no evvent that will be triggered when the formating or color gets
changged in a workbook. "Noob McKnownowt" wrote: hey guys, i got a problem i am using colours to trigger events in my code, everything works fine apart from the event triggered by green, heres my code: If Weekday(Now()) = vbWednesday Then For Each CellWed In RngWed If WorksheetFunction.IsNumber(CellWed.Value) And CellWed.Value <= 17.59 And CellWed.Font.Color < RGB(255, 0, 0) And CellWed.Font.Color < RGB(0, 255, 0) And CellWed.Font.Color < RGB(0, 0, 255) Then CountEmp = CountEmp + 1 ElseIf CellWed.Font.Color = RGB(255, 0, 0) Then CountHalfDay = CountHalfDay + 1 ElseIf CellWed.Value = "Holiday" Then CountHoliday = CountHoliday + 1 ElseIf CellWed.Font.Color = RGB(0, 255, 0) Then CountSickHD = CountSickHD + 1 ElseIf CellWed.Value = "Sick" Then CountSick = CountSick + 1 ElseIf CellWed.Value = "A/A" Or CellWed.Value = "A\A" Then CountAabsence = CountAabsence + 1 ElseIf CellWed.Font.Color = RGB(0, 0, 255) Then CountAabsenceHD = CountAabsenceHD + 1 ElseIf CellWed.Value = "U/A" Or CellWed.Value = "U\A" Then CountUnabsence = CountUnabsence + 1 ElseIf CellWed.Value = "S/U" Or CellWed.Value = "S\U" Then CountSuspend = CountSuspend + 1 End If Next CellWed i know what you may be thinking i am selecting the wrong font colour green, just to let you know i am selecting the green that is 4 columns in from the left and one row down on the excel colour palette, funnily enough the one tagged "green" both the blue and red work fine. why does this code not work? please help!! The Noob. |
Whats wrong with this!!!!!
On Jan 14, 5:35 am, Noob McKnownowt
wrote: hey guys, i got a problem i am using colours to trigger events in my code, everything works fine apart from the event triggered by green, heres my code: If Weekday(Now()) = vbWednesday Then For Each CellWed In RngWed If WorksheetFunction.IsNumber(CellWed.Value) And CellWed.Value <= 17.59 And CellWed.Font.Color < RGB(255, 0, 0) And CellWed.Font.Color < RGB(0, 255, 0) And CellWed.Font.Color < RGB(0, 0, 255) Then CountEmp = CountEmp + 1 ElseIf CellWed.Font.Color = RGB(255, 0, 0) Then CountHalfDay = CountHalfDay + 1 ElseIf CellWed.Value = "Holiday" Then CountHoliday = CountHoliday + 1 ElseIf CellWed.Font.Color = RGB(0, 255, 0) Then CountSickHD = CountSickHD + 1 ElseIf CellWed.Value = "Sick" Then CountSick = CountSick + 1 ElseIf CellWed.Value = "A/A" Or CellWed.Value = "A\A" Then CountAabsence = CountAabsence + 1 ElseIf CellWed.Font.Color = RGB(0, 0, 255) Then CountAabsenceHD = CountAabsenceHD + 1 ElseIf CellWed.Value = "U/A" Or CellWed.Value = "U\A" Then CountUnabsence = CountUnabsence + 1 ElseIf CellWed.Value = "S/U" Or CellWed.Value = "S\U" Then CountSuspend = CountSuspend + 1 End If Next CellWed i know what you may be thinking i am selecting the wrong font colour green, just to let you know i am selecting the green that is 4 columns in from the left and one row down on the excel colour palette, funnily enough the one tagged "green" both the blue and red work fine. why does this code not work? please help!! The Noob. On my pallet the 4th over and 2nd down is a dark green. When I color the font with the 4th over and 4th down (a bright light green) I think your code works. |
All times are GMT +1. The time now is 06:39 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com