color column

A

a

thank you
is there any way to color columns in subform data sheet
example
let user change color of every column
notes
i can use conditional form but this not let user select prefer color
i hope you understand me
 
G

Graham Mandeno

You can modify conditional formatting "on the fly" using code. For example:

Public Function SetColumnBackground(ctl as Control, NewColour as Long)
Dim fc as FormatCondition
With ctl.FormatConditions
If .Count = 0 Then
Set fc = .Add(acExpression,,"1=1")
Else
Set fc = .Item(0)
End If
End With
fc.BackColor = NewColour
End Function

To set a column background to bright green:
Call SetColumnBackground(Me("Control1"), RGB(0,255,0))

Note that this assumes conditional formatting is not being used for anything
else. If it is then your code would need to do a bit more work.
 

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

Top