Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default flash cell colours from white to red and back again

When a check box is ticked, I would like to automatically change any whote
cells to red, throw up the MsgBox and then change the red back again to
white. When I call the macro I get a run-time error '438'. My code that I am
trying to use is:

Public Sub PriorityWarning()

With Sheets(1)
Cells.Select
If .BackColor = RGB(255, 255, 255) Then
.BackColor = RGB(255, 51, 0)
End If
MsgBox "Priority EPCON1!", vbOKOnly, "EPCON LEVEL"
If .BackColor = RGB(255, 51, 0) Then
.BackColor = RGB(255, 255, 255)
End If
End With

End Sub

Thanks,

Mark
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default flash cell colours from white to red and back again

Public Sub PriorityWarning()

Sheets(1).Activate
With ActiveCell
If .Interior.Color = RGB(255, 255, 255) Then
.Interior.Color = RGB(255, 51, 0)
End If
MsgBox "Priority EPCON1!", vbOKOnly, "EPCON LEVEL"
If .Interior.Color = RGB(255, 51, 0) Then
.Interior.Color = RGB(255, 255, 255)
End If
End With

End Sub

"MarkyB" wrote:

When a check box is ticked, I would like to automatically change any whote
cells to red, throw up the MsgBox and then change the red back again to
white. When I call the macro I get a run-time error '438'. My code that I am
trying to use is:

Public Sub PriorityWarning()

With Sheets(1)
Cells.Select
If .BackColor = RGB(255, 255, 255) Then
.BackColor = RGB(255, 51, 0)
End If
MsgBox "Priority EPCON1!", vbOKOnly, "EPCON LEVEL"
If .BackColor = RGB(255, 51, 0) Then
.BackColor = RGB(255, 255, 255)
End If
End With

End Sub

Thanks,

Mark

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default flash cell colours from white to red and back again

Sorry Joel nothing happens apart from showing the msgbox, but it has
eliminated the run-time error..

"Joel" wrote:

Public Sub PriorityWarning()

Sheets(1).Activate
With ActiveCell
If .Interior.Color = RGB(255, 255, 255) Then
.Interior.Color = RGB(255, 51, 0)
End If
MsgBox "Priority EPCON1!", vbOKOnly, "EPCON LEVEL"
If .Interior.Color = RGB(255, 51, 0) Then
.Interior.Color = RGB(255, 255, 255)
End If
End With

End Sub

"MarkyB" wrote:

When a check box is ticked, I would like to automatically change any whote
cells to red, throw up the MsgBox and then change the red back again to
white. When I call the macro I get a run-time error '438'. My code that I am
trying to use is:

Public Sub PriorityWarning()

With Sheets(1)
Cells.Select
If .BackColor = RGB(255, 255, 255) Then
.BackColor = RGB(255, 51, 0)
End If
MsgBox "Priority EPCON1!", vbOKOnly, "EPCON LEVEL"
If .BackColor = RGB(255, 51, 0) Then
.BackColor = RGB(255, 255, 255)
End If
End With

End Sub

Thanks,

Mark

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default flash cell colours from white to red and back again

All that means is the present color of the cell is not the two choise you
have in the code. Color is a problem becuase RGB sets a number but color
returns a string. Try colorindex

Public Sub PriorityWarning()

Sheets(1).Activate
With ActiveCell
If .Interior.ColorIndex = xlNone Then
.Interior.ColorIndex = 3
End If
MsgBox "Priority EPCON1!", vbOKOnly, "EPCON LEVEL"
If .Interior.ColorIndex = 3 Then
.Interior.ColorIndex = xlNone
End If
End With

End Sub

"MarkyB" wrote:

Sorry Joel nothing happens apart from showing the msgbox, but it has
eliminated the run-time error..

"Joel" wrote:

Public Sub PriorityWarning()

Sheets(1).Activate
With ActiveCell
If .Interior.Color = RGB(255, 255, 255) Then
.Interior.Color = RGB(255, 51, 0)
End If
MsgBox "Priority EPCON1!", vbOKOnly, "EPCON LEVEL"
If .Interior.Color = RGB(255, 51, 0) Then
.Interior.Color = RGB(255, 255, 255)
End If
End With

End Sub

"MarkyB" wrote:

When a check box is ticked, I would like to automatically change any whote
cells to red, throw up the MsgBox and then change the red back again to
white. When I call the macro I get a run-time error '438'. My code that I am
trying to use is:

Public Sub PriorityWarning()

With Sheets(1)
Cells.Select
If .BackColor = RGB(255, 255, 255) Then
.BackColor = RGB(255, 51, 0)
End If
MsgBox "Priority EPCON1!", vbOKOnly, "EPCON LEVEL"
If .BackColor = RGB(255, 51, 0) Then
.BackColor = RGB(255, 255, 255)
End If
End With

End Sub

Thanks,

Mark

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default flash cell colours from white to red and back again

Hi Joel, thanks for your help but still nothing happens. Still I have learnt
more. It was going to be a humurous aspect to a client brief that when they
request an urgent priority we would try to flash the colours and show a
msgbox. msgbox works fine!

"Joel" wrote:

All that means is the present color of the cell is not the two choise you
have in the code. Color is a problem becuase RGB sets a number but color
returns a string. Try colorindex

Public Sub PriorityWarning()

Sheets(1).Activate
With ActiveCell
If .Interior.ColorIndex = xlNone Then
.Interior.ColorIndex = 3
End If
MsgBox "Priority EPCON1!", vbOKOnly, "EPCON LEVEL"
If .Interior.ColorIndex = 3 Then
.Interior.ColorIndex = xlNone
End If
End With

End Sub

"MarkyB" wrote:

Sorry Joel nothing happens apart from showing the msgbox, but it has
eliminated the run-time error..

"Joel" wrote:

Public Sub PriorityWarning()

Sheets(1).Activate
With ActiveCell
If .Interior.Color = RGB(255, 255, 255) Then
.Interior.Color = RGB(255, 51, 0)
End If
MsgBox "Priority EPCON1!", vbOKOnly, "EPCON LEVEL"
If .Interior.Color = RGB(255, 51, 0) Then
.Interior.Color = RGB(255, 255, 255)
End If
End With

End Sub

"MarkyB" wrote:

When a check box is ticked, I would like to automatically change any whote
cells to red, throw up the MsgBox and then change the red back again to
white. When I call the macro I get a run-time error '438'. My code that I am
trying to use is:

Public Sub PriorityWarning()

With Sheets(1)
Cells.Select
If .BackColor = RGB(255, 255, 255) Then
.BackColor = RGB(255, 51, 0)
End If
MsgBox "Priority EPCON1!", vbOKOnly, "EPCON LEVEL"
If .BackColor = RGB(255, 51, 0) Then
.BackColor = RGB(255, 255, 255)
End If
End With

End Sub

Thanks,

Mark



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default flash cell colours from white to red and back again

It means that the current color of the cell is something other than None or
Red.
none will equal -4142 or red will equal 3

try executing this line and see which color is returned
MsgBox ("Current color is " & ActiveCell.Interior.ColorIndex)

"MarkyB" wrote:

Hi Joel, thanks for your help but still nothing happens. Still I have learnt
more. It was going to be a humurous aspect to a client brief that when they
request an urgent priority we would try to flash the colours and show a
msgbox. msgbox works fine!

"Joel" wrote:

All that means is the present color of the cell is not the two choise you
have in the code. Color is a problem becuase RGB sets a number but color
returns a string. Try colorindex

Public Sub PriorityWarning()

Sheets(1).Activate
With ActiveCell
If .Interior.ColorIndex = xlNone Then
.Interior.ColorIndex = 3
End If
MsgBox "Priority EPCON1!", vbOKOnly, "EPCON LEVEL"
If .Interior.ColorIndex = 3 Then
.Interior.ColorIndex = xlNone
End If
End With

End Sub

"MarkyB" wrote:

Sorry Joel nothing happens apart from showing the msgbox, but it has
eliminated the run-time error..

"Joel" wrote:

Public Sub PriorityWarning()

Sheets(1).Activate
With ActiveCell
If .Interior.Color = RGB(255, 255, 255) Then
.Interior.Color = RGB(255, 51, 0)
End If
MsgBox "Priority EPCON1!", vbOKOnly, "EPCON LEVEL"
If .Interior.Color = RGB(255, 51, 0) Then
.Interior.Color = RGB(255, 255, 255)
End If
End With

End Sub

"MarkyB" wrote:

When a check box is ticked, I would like to automatically change any whote
cells to red, throw up the MsgBox and then change the red back again to
white. When I call the macro I get a run-time error '438'. My code that I am
trying to use is:

Public Sub PriorityWarning()

With Sheets(1)
Cells.Select
If .BackColor = RGB(255, 255, 255) Then
.BackColor = RGB(255, 51, 0)
End If
MsgBox "Priority EPCON1!", vbOKOnly, "EPCON LEVEL"
If .BackColor = RGB(255, 51, 0) Then
.BackColor = RGB(255, 255, 255)
End If
End With

End Sub

Thanks,

Mark

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default flash cell colours from white to red and back again

Nope, still no change. Index is indeed -4142. Only thing to happen is the
msgbox.
"Joel" wrote:

It means that the current color of the cell is something other than None or
Red.
none will equal -4142 or red will equal 3

try executing this line and see which color is returned
MsgBox ("Current color is " & ActiveCell.Interior.ColorIndex)

"MarkyB" wrote:

Hi Joel, thanks for your help but still nothing happens. Still I have learnt
more. It was going to be a humurous aspect to a client brief that when they
request an urgent priority we would try to flash the colours and show a
msgbox. msgbox works fine!

"Joel" wrote:

All that means is the present color of the cell is not the two choise you
have in the code. Color is a problem becuase RGB sets a number but color
returns a string. Try colorindex

Public Sub PriorityWarning()

Sheets(1).Activate
With ActiveCell
If .Interior.ColorIndex = xlNone Then
.Interior.ColorIndex = 3
End If
MsgBox "Priority EPCON1!", vbOKOnly, "EPCON LEVEL"
If .Interior.ColorIndex = 3 Then
.Interior.ColorIndex = xlNone
End If
End With

End Sub

"MarkyB" wrote:

Sorry Joel nothing happens apart from showing the msgbox, but it has
eliminated the run-time error..

"Joel" wrote:

Public Sub PriorityWarning()

Sheets(1).Activate
With ActiveCell
If .Interior.Color = RGB(255, 255, 255) Then
.Interior.Color = RGB(255, 51, 0)
End If
MsgBox "Priority EPCON1!", vbOKOnly, "EPCON LEVEL"
If .Interior.Color = RGB(255, 51, 0) Then
.Interior.Color = RGB(255, 255, 255)
End If
End With

End Sub

"MarkyB" wrote:

When a check box is ticked, I would like to automatically change any whote
cells to red, throw up the MsgBox and then change the red back again to
white. When I call the macro I get a run-time error '438'. My code that I am
trying to use is:

Public Sub PriorityWarning()

With Sheets(1)
Cells.Select
If .BackColor = RGB(255, 255, 255) Then
.BackColor = RGB(255, 51, 0)
End If
MsgBox "Priority EPCON1!", vbOKOnly, "EPCON LEVEL"
If .BackColor = RGB(255, 51, 0) Then
.BackColor = RGB(255, 255, 255)
End If
End With

End Sub

Thanks,

Mark

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default flash cell colours from white to red and back again

Isn't the cell red when the message box appears? Then turns back to blank
after message box closes

"MarkyB" wrote:

Nope, still no change. Index is indeed -4142. Only thing to happen is the
msgbox.
"Joel" wrote:

It means that the current color of the cell is something other than None or
Red.
none will equal -4142 or red will equal 3

try executing this line and see which color is returned
MsgBox ("Current color is " & ActiveCell.Interior.ColorIndex)

"MarkyB" wrote:

Hi Joel, thanks for your help but still nothing happens. Still I have learnt
more. It was going to be a humurous aspect to a client brief that when they
request an urgent priority we would try to flash the colours and show a
msgbox. msgbox works fine!

"Joel" wrote:

All that means is the present color of the cell is not the two choise you
have in the code. Color is a problem becuase RGB sets a number but color
returns a string. Try colorindex

Public Sub PriorityWarning()

Sheets(1).Activate
With ActiveCell
If .Interior.ColorIndex = xlNone Then
.Interior.ColorIndex = 3
End If
MsgBox "Priority EPCON1!", vbOKOnly, "EPCON LEVEL"
If .Interior.ColorIndex = 3 Then
.Interior.ColorIndex = xlNone
End If
End With

End Sub

"MarkyB" wrote:

Sorry Joel nothing happens apart from showing the msgbox, but it has
eliminated the run-time error..

"Joel" wrote:

Public Sub PriorityWarning()

Sheets(1).Activate
With ActiveCell
If .Interior.Color = RGB(255, 255, 255) Then
.Interior.Color = RGB(255, 51, 0)
End If
MsgBox "Priority EPCON1!", vbOKOnly, "EPCON LEVEL"
If .Interior.Color = RGB(255, 51, 0) Then
.Interior.Color = RGB(255, 255, 255)
End If
End With

End Sub

"MarkyB" wrote:

When a check box is ticked, I would like to automatically change any whote
cells to red, throw up the MsgBox and then change the red back again to
white. When I call the macro I get a run-time error '438'. My code that I am
trying to use is:

Public Sub PriorityWarning()

With Sheets(1)
Cells.Select
If .BackColor = RGB(255, 255, 255) Then
.BackColor = RGB(255, 51, 0)
End If
MsgBox "Priority EPCON1!", vbOKOnly, "EPCON LEVEL"
If .BackColor = RGB(255, 51, 0) Then
.BackColor = RGB(255, 255, 255)
End If
End With

End Sub

Thanks,

Mark

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default flash cell colours from white to red and back again

Brilliant! Must have had another cell active that I couldn't see on screen.

Thanks a million Joel

"Joel" wrote:

Isn't the cell red when the message box appears? Then turns back to blank
after message box closes

"MarkyB" wrote:

Nope, still no change. Index is indeed -4142. Only thing to happen is the
msgbox.
"Joel" wrote:

It means that the current color of the cell is something other than None or
Red.
none will equal -4142 or red will equal 3

try executing this line and see which color is returned
MsgBox ("Current color is " & ActiveCell.Interior.ColorIndex)

"MarkyB" wrote:

Hi Joel, thanks for your help but still nothing happens. Still I have learnt
more. It was going to be a humurous aspect to a client brief that when they
request an urgent priority we would try to flash the colours and show a
msgbox. msgbox works fine!

"Joel" wrote:

All that means is the present color of the cell is not the two choise you
have in the code. Color is a problem becuase RGB sets a number but color
returns a string. Try colorindex

Public Sub PriorityWarning()

Sheets(1).Activate
With ActiveCell
If .Interior.ColorIndex = xlNone Then
.Interior.ColorIndex = 3
End If
MsgBox "Priority EPCON1!", vbOKOnly, "EPCON LEVEL"
If .Interior.ColorIndex = 3 Then
.Interior.ColorIndex = xlNone
End If
End With

End Sub

"MarkyB" wrote:

Sorry Joel nothing happens apart from showing the msgbox, but it has
eliminated the run-time error..

"Joel" wrote:

Public Sub PriorityWarning()

Sheets(1).Activate
With ActiveCell
If .Interior.Color = RGB(255, 255, 255) Then
.Interior.Color = RGB(255, 51, 0)
End If
MsgBox "Priority EPCON1!", vbOKOnly, "EPCON LEVEL"
If .Interior.Color = RGB(255, 51, 0) Then
.Interior.Color = RGB(255, 255, 255)
End If
End With

End Sub

"MarkyB" wrote:

When a check box is ticked, I would like to automatically change any whote
cells to red, throw up the MsgBox and then change the red back again to
white. When I call the macro I get a run-time error '438'. My code that I am
trying to use is:

Public Sub PriorityWarning()

With Sheets(1)
Cells.Select
If .BackColor = RGB(255, 255, 255) Then
.BackColor = RGB(255, 51, 0)
End If
MsgBox "Priority EPCON1!", vbOKOnly, "EPCON LEVEL"
If .BackColor = RGB(255, 51, 0) Then
.BackColor = RGB(255, 255, 255)
End If
End With

End Sub

Thanks,

Mark

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
how do I set all my worksheet background colours to white? CD New Users to Excel 2 May 8th 08 11:29 AM
Remove white spaces in Back dziw Excel Discussion (Misc queries) 2 July 19th 06 06:48 PM
EXCEL workbook is off-white, goes white in edit mode Joe Excel Discussion (Misc queries) 0 July 15th 06 12:45 PM
Is it possible to make a cell flash between 2 colours? barry24uk Excel Worksheet Functions 6 January 4th 06 03:25 AM
Excel 2003 font colours and cell colours bretta Excel Discussion (Misc queries) 1 April 17th 05 03:45 AM


All times are GMT +1. The time now is 09:57 PM.

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

About Us

"It's about Microsoft Excel"