color column

  • Thread starter Thread starter a
  • Start date Start date
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
 
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.
 
Back
Top