当我选择单元格G3并运行宏时:它将从单元格I3复制值并将其作为值粘贴到带有负号( - )的选定单元格中,并选择整行并填充蓝色。 工作行并不总是相同,但是comlumns是固定的。
谢谢Vojtech
编辑:
Sub A_2()
Dim X As String
Dim y As String
X = ActiveCell.Offset(0, 2).Address
y = ActiveCell.Offset(0, 2).Address
ActiveCell = "=-IFERROR(VALUE(" & X & ":" & y & "),(CONCATENATE(" & X & ":" & y & ")))"
ActiveCell.Replace What:="$", Replacement:="", Lookat:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Application.CutCopyMode = False
ActiveCell.EntireRow.Select
If Selection.Interior.Color = vbYellow Then
With Selection.Interior
.Pattern = xlNone
.TintAndShade = 0
.PatternTintAndShade = 0
End With
Else
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = vbYellow
.TintAndShade = 0
.PatternTintAndShade = 0
End With
End If
End Sub