I'm not exactly sure of the purpose of the macro, however on these lines here:
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
If all these are supposed to apply to Sheets("12 mo inc det") then they will need a . before each line. Otherwise they are going to try to apply to the active workbook. Adjust everything within you "With block" is going to be difficult. You can't just add . a the beginning of the line. You need it in very specific locations within the code. Any time an object refers to the sheet named in the with block it needs to be tied by to that sheet, such as:
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
.Application.CutCopyMode = False
.Range("ah13").Select
However in some cases it will look like:
Dim keyRange As Range, keyRow As Range
Set keyRange = .Range("a1", Range("a65536").End(xlUp))
Set keyRow = .Columns(1).Find(what:="4010", LookIn:=xlValues, lookat:=xlPart)
If keyRow Is Nothing Then
MsgBox "not found"
Else
keyRow = keyRow
GPR = (.Cells(keyRow.Row, 14).Value)
End If
Like I said, without knowing the purpose of the code its hard to find every object that needs to be tied to the "parent" sheet. I hope this makes sense.
Bookmarks