Hi guys,
I am using this code to copy columns C,D, and P from a user selected workbook into position C,D,E of workbook "Checklist.xlsx" (the one from were I run the VBA code). I don't have a clue about VBA, just have been gathering info, but the code works pretty fine. The only issue is that it opens twice the workbook "wbExt" hence the system prompts me if i want to reopen the already open workbook (anoying).
Some questions:
1) Is there a way to copy the 3 columns at once? something like "Columns("C:D, P").Select".
2) Is there a way to select the workbook from were to copy the column without needing it to actually open?
3) is there a way to paste the columns starting from row 3 instead of row 1 (Range("C1").Select)?
I would really appreciate your help.
Thank you.
Regards,
Sub copyfromothersheet()
'
' copyfromothersheet Macro
'
Dim wbExt As Workbook
'
NewFN = Application.GetOpenFilename(FileFilter:="Excel Files (*.xlsx),*.xlsx", Title:="Select a file")
If NewFN = False Then
' They pressed Cancel
MsgBox "Stopping because you did not select a file"
Exit Sub
Else
Workbooks.Open Filename:=NewFN
End If
Set wbExt = Workbooks.Open(NewFN)
wbExt.Activate
Columns("C:D").Select
Selection.Copy
Windows("Checklist.xlsx").Activate
Range("C1").Select
ActiveSheet.Paste
wbExt.Activate
Columns("P:P").Select
Application.CutCopyMode = False
Selection.Copy
Windows("Checklist.xlsx").Activate
Columns("E:E").Select
ActiveSheet.Paste
End Sub
Bookmarks