由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
CS版 - can anyone help me with a vba code? (you bao zi)
相关主题
算法疑问[转载] Canon BJC-210 Color 打印机和墨盒请教
VBA ask for help请问color imaging这个方向怎样?
小白问一个vba的代码问题这个图论题怎么做?
哪里有对range data 进行triangulation的软件can anyone help me with a vba code? (you bao zi) (转载)
问两个低级mobile computing问题一道没答上来的面试题-大虾们进来讲讲
问题VBA public function求助
Python: index out of rang error[合集] Excel中的问题
区间图着色问题是多项式可解的?[合集] VB里如何把variant转成range?
相关话题的讨论汇总
话题: end话题: range话题: color话题: set话题: rng
进入CS版参与讨论
1 (共1页)
V******n
发帖数: 881
1
Sub Testing()
' Fill a range with numbers from 1 to 256.
Dim rng As Range
Set rng = Range("BF4:BF256")
Range("BF4") = 1
Range("BF5") = 2
Range("BF4:BF5").AutoFill Destination:=rng



' Add a 2-color scale.
Dim cs As ColorScale
Set cs = rng.FormatConditions.AddColorScale(ColorScaleType:=2)
' Format the first color as red
With cs.ColorScaleCriteria(1)
.Type = xlConditionValueLowestValue
With .FormatColor
.Color = vbRed
' TintAndShade takes a value between -1 and 1.
' -1 is darkest, 1 is lightest.
.TintAndShade = 0
End With
End With

' Format the second color as green, at the highest value.
With cs.ColorScaleCriteria(2)
.Type = xlConditionValueHighestValue
With .FormatColor
.Color = vbGreen
.TintAndShade = 0
End With
End With

' Try again with a rectangular range of values.
' Lowest values should be red, values at the 50th percentile
' should be red/green, high values are green.
Set rng = Range("v4", "ak19")
rng.FormatConditions.Delete
Set cs = rng.FormatConditions.AddColorScale(ColorScaleType:=3)

' Set the color of the lowest value, with a range up to
' the next scale criteria. The color should be red.
With cs.ColorScaleCriteria(1)
.Type = xlConditionValueLowestValue
With .FormatColor
.Color = vbRed
.TintAndShade = 0
End With
End With


' At the 50th percentile, the color should be yellow.
' Note that you cannot set the Value property for all
' values of Type.
With cs.ColorScaleCriteria(2)
.Type = xlConditionValuePercentile
.Value = 50
With .FormatColor
.Color = vbYellow
.TintAndShade = 0
End With
End With

' At the highest value, the color should be green.
With cs.ColorScaleCriteria(3)
.Type = xlConditionValueHighestValue
With .FormatColor
.Color = vbGreen
.TintAndShade = 0
End With
End With


' Add hide font color
Dim cell As Variant

'Dim rng As Range

Set rng = Range("v4:ak19")
For Each cell In Selection
cell.Font.Color = cell.Interior.Color
Next
End Sub
"
the last segment somehow doesn't work. please help! thanks and bao zi feng
shang!
Set rng = Range("v4:ak19")
For Each cell In Selection
cell.Font.Color = cell.Interior.Color
Next
1 (共1页)
进入CS版参与讨论
相关主题
[合集] VB里如何把variant转成range?问两个低级mobile computing问题
下周显然只有mini,没有revised full size iPad问题
问一个 Access VBA programming的问题Python: index out of rang error
nook color 屏幕闪烁?区间图着色问题是多项式可解的?
算法疑问[转载] Canon BJC-210 Color 打印机和墨盒请教
VBA ask for help请问color imaging这个方向怎样?
小白问一个vba的代码问题这个图论题怎么做?
哪里有对range data 进行triangulation的软件can anyone help me with a vba code? (you bao zi) (转载)
相关话题的讨论汇总
话题: end话题: range话题: color话题: set话题: rng