带有粘贴特殊值的Excel CopyRange宏

时间:2018-10-15 16:10:31

标签: copy-paste

我目前有一列,其中包含来自b列中表单的实时数据。我一直试图将一个宏放在一起,它将宏从b列复制实时数据并粘贴为特殊值(仅文本)到下一个空白列。

就我所掌握的脚本而言;

Sub CopyRange()

Dim source As Worksheet
Dim destination As Worksheet
Dim emptyColumn As Long

Set source = Sheets("Risk Assessment Log")
Set destination = Sheets("Risk Assessment Log")

'find empty Column (actually cell in Row 1)'
emptyColumn = destination.Cells(1, destination.Columns.Count).End(xlToLeft).Column
If emptyColumn > 1 Then
emptyColumn = emptyColumn + 1
End If

source.Range("B1:B27").Copy destination.Cells(1, emptyColumn)
'find empty Column (actually cell in Row 1)'
emptyColumn = destination.Cells(1, destination.Columns.Count).End(xlToLeft).Column

Sheets("Risk Assessment").Select


End Sub

任何人都可以帮助

0 个答案:

没有答案