Conditioning Format Question!

  • Thread starter Thread starter Bob
  • Start date Start date
B

Bob

Can I condition a cell to have a shading until it is selected, trying to get
round printing one cell in a selection
--
Thanks in advance for your help....Bob Vance
..
..
..
..
 
Bob

one way:

for cell C3, set "Formula is": =C3="" and change the background colour.

When the cell is empty, it will be coloured. When you put something in the
cell it won't.

Regards

Trevor
 
Hi bob
AFAIK not withou VBA. You may use the worksheet Selection_change event.
Put the following code in your worksheet module (will test cells
A1:A10)

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Target.Cells.count > 1 Then Exit Sub
If Intersect(Target, Me.Range("A1:A10")) Is Nothing Then Exit Sub
With Target
.Interior.ColorIndex = xlColorIndexNone
End With

End Sub
 
That worked great but can it go back to being shaded after I deselect cell??

--
Thanks in advance for your help....Bob Vance
..
..
..
..
 
Hi Bob
you may try the following: Change the colorindex=3 (Red color) to your
needs

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Target.Cells.count > 1 Then Exit Sub
Application.ScreenUpdating = False
Range("A1:A10").Interior.ColorIndex = 3
Target.Interior.ColorIndex = xlColorIndexNone
Application.ScreenUpdating = True
End Sub
 
Thanks Frank that brilliant, now I will have to alter it so every left
corner of every invoice will get the red square, there will be about 1000
invoices that will be created on a worksheet that wont be a problem will it?

--
Thanks in advance for your help....Bob Vance
..
..
..
..
 
Frank if you wanted every top left corner of page breaks to be highlighted
(72,8) there wouldn't be a shortcut way of writing it??

--
Thanks in advance for your help....Bob Vance
..
..
..
..
 
Hi bob
I somehow remebered this famous (72,8) from a previous post but I don't
recall what you're trying to say with that! (evere 72nd row?)
 
Like A1 + steps of 72
H1 + steps of 72
Have this in one of my formulas
Set destRng = .Cells
For i = .Row + 72 To 5112 Step 72
--
Thanks in advance for your help....Bob Vance
..
..
..
..
 
yes Frank my invoices are every 72 rows 8 Columns wide

--
Thanks in advance for your help....Bob Vance
..
..
..
..
 
Hi bob
try something like the following (untested): starts in row 1 and colors
every 72nd row (1, 73, 145, etc.)

If Target.Cells.count > 1 Then Exit Sub
Dim i as long
Application.ScreenUpdating = False
For i = 1 to 5113 step 72
cells(i,"A").Interior.ColorIndex = 3
next
Target.Interior.ColorIndex = xlColorIndexNone
Application.ScreenUpdating = True
End Sub
 
Hi
#$%&/ copy and paste. Add as first line the sub procedure name:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
 
Brilliant Frank and if I want to extend it to J Column S Column........so
on?

--
Thanks in advance for your help....Bob Vance
..
..
..
..
 
Hi Bob
come on, you should be able to do this on your own by now :-)

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Cells.count > 1 Then Exit Sub
Dim i as long
Application.ScreenUpdating = False
For i = 1 to 5113 step 72
cells(i,"A").Interior.ColorIndex = 3
cells(i,"J").Interior.ColorIndex = 3
cells(i,"S").Interior.ColorIndex = 3
next
Target.Interior.ColorIndex = xlColorIndexNone
Application.ScreenUpdating = True
End Sub
 
Sorry yes I did do it for the whole sheet which was 24 sheets wide, but the
lag was just to much so I have just got a crossed cell that prints, but was
worth the exercise, If you ever think of how I can print without out
printing that one cell please let me know

--
Thanks in advance for your help....Bob Vance
..
..
..
..
 
Back
Top