Macro for shading

  • Thread starter Thread starter Atomic
  • Start date Start date
A

Atomic

I'd like to know wheater it is possible to have a cell shaded once an action
has been taken on it.

For example I have each cell in collums [A1] ---> [D1] with a drop
list/validation. Once action has been taken I'd like for it to become shaded.
Is this possible?

Thank you in advance.
 
Hi,
If you mean a specific action, ie a specific entry into a cell, then you can
do that with conditional formatting.
If you mean a more general action, like the selection of an option (but no
particular option) from the drop down menu, then you'd need a Change Event
macro.
Regards - Dave.
 
I'd like to know wheater it is possible to have a cell shaded once an action
has been taken on it.

For example I have each cell in collums [A1] ---> [D1] with a drop
list/validation. Once action has been taken I'd like for it to become shaded.
Is this possible?

Thank you in advance.


Try if this macro does what you expect:

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, Range("A1:D1")) Is Nothing Then
Target.Interior.ColorIndex = 15
End If
End Sub

Hope this helps / Lars-Åke
 
Thank you Lars-Ã…ke, that is exactly what I had in mind.

I noticed that the colour stayed as is when the entry was removed or
deleted. Is there a way to return it to "white" if say I enter a a "00" in
the cell or if the entry was deleted?

Thank you.


Lars-Ã…ke Aspelin said:
I'd like to know wheater it is possible to have a cell shaded once an action
has been taken on it.

For example I have each cell in collums [A1] ---> [D1] with a drop
list/validation. Once action has been taken I'd like for it to become shaded.
Is this possible?

Thank you in advance.


Try if this macro does what you expect:

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, Range("A1:D1")) Is Nothing Then
Target.Interior.ColorIndex = 15
End If
End Sub

Hope this helps / Lars-Ã…ke
 
The following sets the background color to white if the value entered
is equal to 0.

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, Range("A1:D1")) Is Nothing Then
Target.Interior.ColorIndex = 15
If Target.Value = 0 Then
Target.Interior.ColorIndex = 0
End If
End If
End Sub

Hope this helps / Lars-Åke


Thank you Lars-Åke, that is exactly what I had in mind.

I noticed that the colour stayed as is when the entry was removed or
deleted. Is there a way to return it to "white" if say I enter a a "00" in
the cell or if the entry was deleted?

Thank you.


Lars-Åke Aspelin said:
I'd like to know wheater it is possible to have a cell shaded once an action
has been taken on it.

For example I have each cell in collums [A1] ---> [D1] with a drop
list/validation. Once action has been taken I'd like for it to become shaded.
Is this possible?

Thank you in advance.


Try if this macro does what you expect:

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, Range("A1:D1")) Is Nothing Then
Target.Interior.ColorIndex = 15
End If
End Sub

Hope this helps / Lars-Åke
 
Thank you Lars-Ã…ke, again. I'll study this formula now and try some new things.
really appreciate it. ^_^)v

Lars-Ã…ke Aspelin said:
The following sets the background color to white if the value entered
is equal to 0.

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, Range("A1:D1")) Is Nothing Then
Target.Interior.ColorIndex = 15
If Target.Value = 0 Then
Target.Interior.ColorIndex = 0
End If
End If
End Sub

Hope this helps / Lars-Ã…ke


Thank you Lars-Ã…ke, that is exactly what I had in mind.

I noticed that the colour stayed as is when the entry was removed or
deleted. Is there a way to return it to "white" if say I enter a a "00" in
the cell or if the entry was deleted?

Thank you.


Lars-Ã…ke Aspelin said:
On Mon, 2 Jun 2008 10:33:00 -0700, Atomic

I'd like to know wheater it is possible to have a cell shaded once an action
has been taken on it.

For example I have each cell in collums [A1] ---> [D1] with a drop
list/validation. Once action has been taken I'd like for it to become shaded.
Is this possible?

Thank you in advance.


Try if this macro does what you expect:

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, Range("A1:D1")) Is Nothing Then
Target.Interior.ColorIndex = 15
End If
End Sub

Hope this helps / Lars-Ã…ke
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top