Hi Guys,
Below is the code which i am trying to copy column from one sheet to another by using input box.What missing in this is, its copying only from the default opened sheet. I need to give input for sheet also similar to source and destination column via input box or any other way. Can anyone pls help me on this?
Sub SelectEntireColumn()
Dim x As String
Dim y As String
'Dim sheet As Range
On Error Resume Next
source_file = Application.GetOpenFilename(FileFilter:="Excel files (*.xls), *.xls", Title:="Please choose a file")
Set sourcefile = Workbooks.Open(Filename:=source_file, ReadOnly:=yes)
'sheet = InputBox("select sheet")
'Worksheets(sheet).Select
x = InputBox("Select the column to copy")
Cells(1, x).Select
Selection.EntireColumn.Select
Selection.Copy
Worksheets("Sheet2").Activate
y = InputBox("select the column to paste")
Cells(1, y).Select
ActiveSheet.Paste
End Sub
Thanking you in advance,
Dee
Below is the code which i am trying to copy column from one sheet to another by using input box.What missing in this is, its copying only from the default opened sheet. I need to give input for sheet also similar to source and destination column via input box or any other way. Can anyone pls help me on this?
Sub SelectEntireColumn()
Dim x As String
Dim y As String
'Dim sheet As Range
On Error Resume Next
source_file = Application.GetOpenFilename(FileFilter:="Excel files (*.xls), *.xls", Title:="Please choose a file")
Set sourcefile = Workbooks.Open(Filename:=source_file, ReadOnly:=yes)
'sheet = InputBox("select sheet")
'Worksheets(sheet).Select
x = InputBox("Select the column to copy")
Cells(1, x).Select
Selection.EntireColumn.Select
Selection.Copy
Worksheets("Sheet2").Activate
y = InputBox("select the column to paste")
Cells(1, y).Select
ActiveSheet.Paste
End Sub
Thanking you in advance,
Dee