|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Cancel = True ' 取消双击操作,以便用户可以输入颜色数据
If Not Intersect(Target, Me.Range("D7:W106")) Is Nothing Then
Dim InputData As String
Dim Red As Integer, Green As Integer, Blue As Integer
InputData = InputBox(" 请输入颜色数据:R,G,B")
If InputData <> "" Then
Red = Fix(CDec(Split(InputData, ",")(0)))
Green = Fix(CDec(Split(InputData, ",")(1)))
Blue = Fix(CDec(Split(InputData, ",")(2)))
With Target.Interior
.Color = RGB(Red, Green, Blue)
End With
Target.NumberFormat = "0"
Dim cellValue As Variant
Dim i As Integer
cellValue = 0
MsgBox TypeName(3)
cellValue = Target.Value '这句可以执行
i = cellValue '这里就报类型不符
RGB_Arr(1, i) = Red
RGB_Arr(2, i) = Green
RGB_Arr(3, i) = Blue
End If
End If
请问大佬们这该如何修改?
|
|