I am trying to create a simple macro, I thought. This will be a Personal macro so I can use it for any workbook. Basically I will save an inventory excel file on my computer. Then open it and what I want is to
Open another excel file (my master) and copy 3 columns from here and insert/paste them onto the inventory workbook.
Every time I try it stops at opening the (master) workbook and does nothing else.
Any help would be great.
Here's the code I got:
Sub Macro1()
'
' Macro1 Macro
' Macro recorded 9/5/2011 by Larry Ross
'
' Keyboard Shortcut: Ctrl+Shift+I
'
Range("D11").Select
ChDir "C:\Users\Larry\Documents\Inventory"
Workbooks.Open Filename:="C:\Users\Larry\Documents\Inventory\master.pmix.xls"
Columns("C:E").Select
Selection.Copy
Windows("inv.pmx.csv").Activate
Columns("D:D").Select
Selection.Insert Shift:=xlToRight
Columns("C:C").EntireColumn.AutoFit
Rows("11:11").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlUp
Range("D8").Select
End Sub
Open another excel file (my master) and copy 3 columns from here and insert/paste them onto the inventory workbook.
Every time I try it stops at opening the (master) workbook and does nothing else.
Any help would be great.
Here's the code I got:
Sub Macro1()
'
' Macro1 Macro
' Macro recorded 9/5/2011 by Larry Ross
'
' Keyboard Shortcut: Ctrl+Shift+I
'
Range("D11").Select
ChDir "C:\Users\Larry\Documents\Inventory"
Workbooks.Open Filename:="C:\Users\Larry\Documents\Inventory\master.pmix.xls"
Columns("C:E").Select
Selection.Copy
Windows("inv.pmx.csv").Activate
Columns("D:D").Select
Selection.Insert Shift:=xlToRight
Columns("C:C").EntireColumn.AutoFit
Rows("11:11").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlUp
Range("D8").Select
End Sub
Last edited: