Hi! Hoping someone can help me understand where this error is coming from. I have a nested macro set up to run a macro off from a drop down list selection. This is the first time i have put something like this together, so i am assuming the combination of the two macro's is causing the problem. I just dont know how to fix it. Any help appreciated!!
here is the code that works with the drop down list:
Sub Worksheet_Change(ByVal Target As Range)
Dim KeyCells As Range
Set KeyCells = Range("c41")
Call twentyfoot
End Sub
here is the macro it calls on:
Sub twentyfoot()
Dim wb As Worksheet: Set wb = ActiveWorkbook.Sheets("Current Loads")
Dim wb2 As Worksheet: Set wb2 = ActiveWorkbook.Sheets("Plant Overview")
Dim rCell As Range
Application.ScreenUpdating = False
For Each rCell In wb.Range("B1:B" & wb.Range("B" & Rows.Count).End(xlUp).Row)
If rCell.Value = wb2.Range("$C$41") And rCell.Offset(0, 2).Value = "20'" And rCell.Offset(0, 3).Value = "EMPTY" And rCell.Offset(0, 13).Value > 5 Then
wb.Range("C" & rCell.Row).Copy
If wb2.Range("b49").Value = "" Then
wb2.Range("b49").PasteSpecial xlPasteValues
Else
wb2.Range("b" & Rows.Count).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
End If
End If
If rCell.Value = wb2.Range("$C$41") And rCell.Offset(0, 2).Value = "20'" And rCell.Offset(0, 3).Value = "EMPTY" And rCell.Offset(0, 13).Value > 5 Then
wb.Range("O" & rCell.Row).Copy
If wb2.Range("d49").Value = "" Then
wb2.Range("d49").PasteSpecial xlPasteValues
Else
wb2.Range("d" & Rows.Count).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
End If
End If
Next rCell
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub
any questions, let me know i will do my best to answer them.
Bookmarks