sungirl2215
New Member
- Joined
- Jul 14, 2022
- Messages
- 7
- Office Version
- 365
- Platform
- Windows
Very new to VAB and I have a workbook with both values and free text survey responses. I'm trying to cut the Free Response Text columns to their own sheet in my workbook. The columns this free text will be in may vary depending on the survey data entered, so I've used the input box to allow the user to select the correct column to be copied.
I understand how to paste that data into specific columns in the new sheet, but this code may be run several times if there are multiple free text columns.
How can I adjust my code to paste to the next available column of the designated sheet? Giving the option to select multiple, non-consecutive columns at once would also work.
I understand how to paste that data into specific columns in the new sheet, but this code may be run several times if there are multiple free text columns.
How can I adjust my code to paste to the next available column of the designated sheet? Giving the option to select multiple, non-consecutive columns at once would also work.
VBA Code:
Sub CopyFreeText()
Dim MySelection As Range
On Error Resume Next
Set MySelection = Application.InputBox("Select the column to move.", "Move Column", Type:=8)
If MySelection Is Nothing Then Exit Sub 'user canceled
On Error GoTo 0
MySelection.EntireColumn.Cut (Sheets("Free Text Response").Range("A:A"))
Application.CutCopyMode = False
End Sub