Excel Forum,
I have a piece of code that works in my personal workbook, but when I copy and paste it into the workbook that will use the macro I receive a run time error 1004.
I believe the error occurs after the new workbook is opened and is an object error.
If more context is needed, all I am trying to do with this macro is data entry from one sheet to another. I want to keep this macro in the sheet where I enter data. The workbook this macro opens changes each month.
Sub CCPIOPstmt()
Dim NewFN As Variant
Dim wbNew As Workbook
NewFN = Application.GetOpenFilename(Title:="Please select a file")
If NewFN = False Then
' They pressed Cancel
MsgBox "Stopping because you did not select a file"
Exit Sub
Else
Set wbNew = Workbooks.Open(Filename:=NewFN)
End If
wbNew.Activate
With Sheets("12 mo inc det")
.Select
.Unprotect
Columns("A:B").EntireColumn.Hidden = False
Range("ah12").Value = "1"
Range("ah12").Copy
Columns("a:a").PasteSpecial Paste:=xlPasteAll, Operation:=xlMultiply
Range("ah13").Select
Thank you for your help. This forum is a great resource.
Bookmarks