Excel vba的时候一直抱运行时错误‘1004’,如何修改
Subtianse()Fori=2To22picture_name=Sheets("sheet3").Range("o"&i).Valuepicture_value=Sh...
Sub tianse()
For i = 2 To 22
picture_name = Sheets("sheet3").Range("o" & i).Value
picture_value = Sheets("sheet3").Range("p" & i)
If picture_value = 0 Then
color_rgb = Sheets("sheet3").Range("t2").Interior.Color
ElseIf picture_value > 0 And picture_value <= 0.015 Then
color_rgb = Sheets("sheet3").Range("t3").Interior.Color
ElseIf picture_value > 0.015 And picture_value <= 0.03 Then
color_rgb = Sheets("sheet3").Range("t4").Interior.Color
ElseIf picture_value > 0.03 And picture_value <= 0.045 Then
color_rgb = Sheets("sheet3").Range("t5").Interior.Color
ElseIf picture_value > 0.045 And picture_value <= 0.06 Then
color_rgb = Sheets("sheet3").Range("t6").Interior.Color
ElseIf picture_value > 0.06 And picture_value <= 0.075 Then
color_rgb = Sheets("sheet3").Range("t7").Interior.Color
ElseIf picture_value > 0.075 And picture_value <= 0.09 Then
color_rgb = Sheets("sheet3").Range("t8").Interior.Color
ElseIf picture_value > 0.09 Then
color_rgb = Sheets("sheet3").Range("t9").Interior.Color
End If
ActiveSheet.Shapes.Range(Array("group10")).Select
ActiveSheet.Shapes(picture_name).Select
Selection.ShapeRange.Fill.ForeColor.RGB = color_rgb
Selection.ShapeRange(1).TextFrame2.TextRange.Characters.Text = FormatPercent(picture_value)
Next i
End Sub 展开
For i = 2 To 22
picture_name = Sheets("sheet3").Range("o" & i).Value
picture_value = Sheets("sheet3").Range("p" & i)
If picture_value = 0 Then
color_rgb = Sheets("sheet3").Range("t2").Interior.Color
ElseIf picture_value > 0 And picture_value <= 0.015 Then
color_rgb = Sheets("sheet3").Range("t3").Interior.Color
ElseIf picture_value > 0.015 And picture_value <= 0.03 Then
color_rgb = Sheets("sheet3").Range("t4").Interior.Color
ElseIf picture_value > 0.03 And picture_value <= 0.045 Then
color_rgb = Sheets("sheet3").Range("t5").Interior.Color
ElseIf picture_value > 0.045 And picture_value <= 0.06 Then
color_rgb = Sheets("sheet3").Range("t6").Interior.Color
ElseIf picture_value > 0.06 And picture_value <= 0.075 Then
color_rgb = Sheets("sheet3").Range("t7").Interior.Color
ElseIf picture_value > 0.075 And picture_value <= 0.09 Then
color_rgb = Sheets("sheet3").Range("t8").Interior.Color
ElseIf picture_value > 0.09 Then
color_rgb = Sheets("sheet3").Range("t9").Interior.Color
End If
ActiveSheet.Shapes.Range(Array("group10")).Select
ActiveSheet.Shapes(picture_name).Select
Selection.ShapeRange.Fill.ForeColor.RGB = color_rgb
Selection.ShapeRange(1).TextFrame2.TextRange.Characters.Text = FormatPercent(picture_value)
Next i
End Sub 展开
展开全部
ActiveSheet.Shapes.Range(Array("group10")).Select
去掉Array()试试,即:
ActiveSheet.Shapes.Range("group10").Select
去掉Array()试试,即:
ActiveSheet.Shapes.Range("group10").Select
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询