how to paste entire column in excel vba without selecting the sheet
17,124
If possible, you should avoid clobbering the user's clipboard in a macro. Just copy the column directly.
Columns(1).Copy Columns(last_col + 1)
Author by
DBWeinstein
Co-Founder at HomeKeepr. Coding hobbyist. Always learning about everything.
Updated on August 21, 2022Comments
-
DBWeinstein over 1 year
I'm trying to copy the first column into the last column. What's wrong with this code? Getting the following error:
Run-time error '438 object doesn't support this property or method
Does vba allow
Copy
but notpaste
for columns?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