dws*_*ein 3 excel vba excel-vba excel-vba-mac
我正在尝试将第一列复制到最后一列.这段代码出了什么问题?收到以下错误:
Run-time error '438
object doesn't support this property or method
Run Code Online (Sandbox Code Playgroud)
vba允许Copy但不允许paste列吗?
Sub copy_ids_user_output(sheet_name As String)
' find last column
Dim last_col As Integer
last_col = Worksheets(sheet_name).Cells(1, Columns.Count).End(xlToLeft).column
Debug.Print last_col
Columns(1).Copy
Columns(last_col + 1).Paste
End Sub
Run Code Online (Sandbox Code Playgroud)
如果可能,您应该避免在宏中破坏用户的剪贴板.只需直接复制列.
Columns(1).Copy Columns(last_col + 1)
Run Code Online (Sandbox Code Playgroud)