Friday, August 31, 2012

How to Copy Entire Column to another Column in Excel with VBA

VBA Macro to Copy Entire Column to another Column in Excel
Sub ColShuffle()
Dim x As Integer
Dim Y As Integer
Dim Z As Integer

Y = InputBox("Enter Column No. To Move ")
Z = InputBox("Enter Destination Column No.")
For x = 1 To 100
Cells(x, Z) = Cells(x, Y)
Next x
End Sub

--Using Do-Until method
Sub ColShuffle_DoUntil()
Dim x
x = 0
Do Until x = 20
x = x + 1
Selection.Offset(x, 0) = Selection.Value
Loop
End Sub

No comments:

Post a Comment

Hi User, Thank You for visiting My Blog. Please post your genuine Feedback or comments only related to this Blog Posts. Please do not post any Spam comments or Advertising kind of comments which will be Ignored.