Atomatic复制并粘贴为值并填充整行

时间:2016-04-18 10:28:49

标签: excel select copy row paste

你能帮我解决这个问题吗?

I have this

当我选择单元格G3并运行宏时:它将从单元格I3复制值并将其作为值粘贴到带有负号( - )的选定单元格中,并选择整行并填充蓝色。 工作行并不总是相同,但是comlumns是固定的。

The result after macro is

谢谢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

0 个答案:

没有答案
相关问题