将sheet1蓝色字体内容提取到sheet2格式。当内容改变点击按钮可以再次将内容提取到sheet2并以此排列。
答:确保Sheet1为活动工作表时,运行下面代码。
Sub Demo()感谢,可以用。完美。
追答Sub Demo()
Dim Cell As Range
Dim DesRng As Range
Set DesRng = Sheets("Sheet2").Cells(Rows.Count, 4).End(xlUp).Offset(1, 0)
For Each Cell In Range("B6:B10")
If Not IsEmpty(Cell) Then
Cell.Resize(1, 6).Copy
With DesRng
.PasteSpecial xlPasteValues
.Offset(0, -3) = Range("F1")
.Offset(0, -2) = Range("B1")
.Offset(0, -1) = Range("B2")
End With
Set DesRng = DesRng.Offset(1, 0)
End If
Next
Application.CutCopyMode = False
End Sub