Hi cmorten82
I assume when you say the Workbook that houses all the Code is hidden you mean it is locked for editing and is password protected.
I've modified the Code I previously provided such that it will work on the Active Workbook and have added it to your Quick Macros.xlsm.
In Module2:
Option Explicit
Sub Unit_Code()
Dim TgtBook As Workbook
Dim cel As Range
Dim visCel As Range
Dim LR As Long
Application.ScreenUpdating = False
Set TgtBook = ActiveWorkbook '<---This assumes the QuickBooks Workbook is active.
With TgtBook.Sheets("Data") '<---Change Sheet Reference Name as required
LR = .Cells.Find("*", .Cells(.Rows.Count, .Columns.Count), SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious).Row - 1
For Each cel In ThisWorkbook.Sheets("Lists").Range("Unit_Code")
.Range("F1:F" & LR).AutoFilter Field:=1, Criteria1:="=*" & cel.Value & " * ", Operator:=xlAnd
If .Range("F1:F" & LR).SpecialCells(xlCellTypeVisible).Cells.Count > 1 Then
For Each visCel In .Range("F2:F" & LR).SpecialCells(xlCellTypeVisible)
.Cells(visCel.Row, "N").Value = cel.Value
Next visCel
End If
Next cel
.AutoFilterMode = False
.Range("N1:N" & LR).AutoFilter Field:=1, Criteria1:="="
If .Range("N1:N" & LR).SpecialCells(xlCellTypeVisible).Cells.Count > 1 Then
For Each visCel In .Range("N2:N" & LR).SpecialCells(xlCellTypeVisible)
visCel.Value = "N/A"
Next visCel
End If
.AutoFilterMode = False
End With
Application.ScreenUpdating = True
End Sub
I've not tested the Code on your Book8.xlsx simply because I have no clue how you get from here to there. Please note this...
Set TgtBook = ActiveWorkbook '<---This assumes the QuickBooks Workbook is active.
With TgtBook.Sheets("Data") '<---Change Sheet Reference Name as required
Bookmarks