Home > Software engineering >  Excel vba has when run-time error '1004', how to modify, ActiveSheet. Shapes (picture_name
Excel vba has when run-time error '1004', how to modify, ActiveSheet. Shapes (picture_name

Time:11-17

Sub tianse ()
For I=2 To 22
Picture_name=Sheets (" sheet3 "). The Range (" o "& amp; I). The Value
Picture_value=https://bbs.csdn.net/topics/Sheets (" sheet3 "). The Range (" p "& amp; I)

If picture_value=https://bbs.csdn.net/topics/0 Then
Color_rgb=Sheets (" sheet3 "). The Range (" t2 "). Interior. Color
ElseIf picture_value & gt; 0 And picture_value & lt;=0.015 Then
Color_rgb=Sheets (" sheet3 "). The Range (" t3 "). Interior. Color
ElseIf picture_value & gt; 0.015 the And picture_value & lt;=0.03 Then
Color_rgb=Sheets (" sheet3 "). The Range (" t4 "). Interior. Color
ElseIf picture_value & gt; 0.03 the And picture_value & lt;=0.045 Then
Color_rgb=Sheets (" sheet3 "). The Range (" 0 "). Interior. Color
ElseIf picture_value & gt; 0.045 the And picture_value & lt;=0.06 Then
Color_rgb=Sheets (" sheet3 "). The Range (" t6 "). Interior. Color
ElseIf picture_value & gt; 0.06 the And picture_value & lt;=0.075 Then
Color_rgb=Sheets (" sheet3 "). The Range (" t7 has "). Interior. Color
ElseIf picture_value & gt; 0.075 the And picture_value & lt;=0.09 Then
Color_rgb=Sheets (" sheet3 "). The Range (t8). Interior. Color
ElseIf picture_value & gt; 0.09 Then
Color_rgb=Sheets (" sheet3 "). The Range (t9). Interior. Color
End the If

Group10 ActiveSheet. Shapes. Range (Array (" ")). Select
ActiveSheet. Shapes (picture_name). Select
Selection. The ShapeRange. The Fill. ForeColor. RGB=color_rgb
Selection. ShapeRange (1). TextFrame2. TextRange. Characters. The Text=FormatPercent (picture_value)

Next I
End Sub

CodePudding user response:

https://www.jianshu.com/p/24470eff186a

I am a copy of this post, like him, see debugging, should be the problem here, SOS distress
ActiveSheet. Shapes (picture_name). Select
Selection. The ShapeRange. The Fill. ForeColor. RGB=color_rgb
Selection. ShapeRange (1). TextFrame2. TextRange. Characters. The Text=FormatPercent (picture_value)

Next I
End Sub
  •  Tags:  
  • VBA
  • Related