How to copy a specific column
Question - issue: The user wanted to have his user type in a week number (1 to 52) to another sheet in the same workbook based on the column number
Answer:
Sub CopyColumn()
Dim C As Integer
Do
'Get the column number
C = Application.InputBox(prompt:="Enter the week number", Type:=1)
'exit if cancel selected
If C = False Then Exit Sub
'confirm number is betweeen 1 and 52
If C >= 1 And C <= 52 Then Exit Do
Loop
'Copy the column to the destination sheet
ActiveCell.EntireColumn.Copy Sheets("sheet2").Columns(C)
'clear copy/paste buffer
Application.CutCopyMode = False
End Sub
|