My current code is pulling too much; need to incorporate this filtering step ASAP but not sure how to accomplish?:
Attached small sample for your viewing to help expedite understanding>: https://app.box.com/s/2h3dhbnsmgcw2rq0soa1
THERE ARE 2 PHASES:
1st Phase, DETERMINE WHAT CODE SHOULD BE USED WHEN WORKING THIS PART #
================================================================
Using the Example:
Target Cell: "J3" of PARTS sheet is PN# 1461M87G24
1- Look for "J3's" MATCH within the TECHORDER sheet Col B
...............................................................
....If MATCH is located:
.........proceed with the 2nd phase using the NON-COLORED cells
................................................................
....If NO MATCH is located, MsgBox: "no match found"
2nd, LOCATE ROWS THAT MEET THE CONDITIONS and COPY a few pieces of Data from that row of TECH ORDER to PARTS sheet
=====================================================================================================
*- Most important Rule/Condition: ONLY USE CELLS that have NOT BEEN colorized
1- Look through Col H for the code identified in Phase 1 (within only NON-COLORED cells)
2- Look through Col H for empty/blank cells (for only the NON-COLORED cells)
IF either 1 or 2 conditions are met/TRUE
THEN, RUN the code I already have (below) to copy adjacent data
================================================================================
I found a line of code that looks at a cell's color, perhaps it can be used somehow
Range("H8:H").Interior.ColorIndex = 0
================================================================================
Here's the code that will follow (and perform the final step of copying):
Attached small sample for your viewing to help expedite understanding>: https://app.box.com/s/2h3dhbnsmgcw2rq0soa1
THERE ARE 2 PHASES:
1st Phase, DETERMINE WHAT CODE SHOULD BE USED WHEN WORKING THIS PART #
================================================================
Using the Example:
Target Cell: "J3" of PARTS sheet is PN# 1461M87G24
1- Look for "J3's" MATCH within the TECHORDER sheet Col B
...............................................................
....If MATCH is located:
.........proceed with the 2nd phase using the NON-COLORED cells
................................................................
....If NO MATCH is located, MsgBox: "no match found"
2nd, LOCATE ROWS THAT MEET THE CONDITIONS and COPY a few pieces of Data from that row of TECH ORDER to PARTS sheet
=====================================================================================================
*- Most important Rule/Condition: ONLY USE CELLS that have NOT BEEN colorized
1- Look through Col H for the code identified in Phase 1 (within only NON-COLORED cells)
2- Look through Col H for empty/blank cells (for only the NON-COLORED cells)
IF either 1 or 2 conditions are met/TRUE
THEN, RUN the code I already have (below) to copy adjacent data
================================================================================
I found a line of code that looks at a cell's color, perhaps it can be used somehow
Range("H8:H").Interior.ColorIndex = 0
================================================================================
Here's the code that will follow (and perform the final step of copying):
Code:
Sheets("TECHORDER").Select
Dim x As Range, pnrng As Range, nr As Long
Application.ScreenUpdating = False
With Sheets("TECHORDER")
For Each x In .Range("B7", .Range("B" & Rows.Count).End(xlUp))
Set pnrng = Sheets("PARTS").Columns(16).Find(x.Value, lookat:=xlWhole)
'COPY THE ADJACENT DATA FOUND on "TechOrder" to the base of the PARTS sheet
'....."TECHORDER" to "PARTS" COLUMNS are: AtoR, BtoP, FtoO and GtoE
If pnrng Is Nothing Then
nr = Sheets("PARTS").Range("P" & Rows.Count).End(xlUp).Offset(1).Row
With Sheets("PARTS").Range("P" & nr)
.Value = x.Value
.Font.FontStyle = "Bold"
.Font.Color = 255
End With
With Sheets("PARTS").Range("O" & nr)
.Value = x.Offset(, 4).Value
.Font.FontStyle = "Bold"
.Font.Color = 255
End With
With Sheets("PARTS").Range("E" & nr)
.Value = x.Offset(, 5).Value
.Font.FontStyle = "Bold"
.Font.Color = 255
End With
' Prob w/ Fig Ref converting into dates and odd numbers like 41319. This is Format>Cells>Text prior to pasting data into it.
' but is still not working quite right - figure out later
'
Range("R5:R2000").Select
Selection.NumberFormat = "@"
With Sheets("PARTS").Range("R" & nr)
.Value = x.Offset(, -1).Value
.Font.FontStyle = "Bold"
.Font.Color = 255
LResult = Left("R", 5)
End With
End If
Next x
End With
' selects column and AUTO-FIT-adjusts the width
With Sheets("PARTS")
.Columns("E:E").AutoFit
.Columns("P:R").AutoFit
.Activate
' Macro1_adjustColumnWIDTH Macro
' selects column and adjusts the width TO A SPECIFIC WIDTH
'
Columns("O:O").Select
Selection.ColumnWidth = 25
End With
Application.ScreenUpdating = True
'RETURNS USER TO CELL A1 RATHER THAN LEAVING A COLUMN HIGLIGHTED
Range("A1").Select
End Sub