I have the following Spreadsheet: [Data in Columns A-Q and almost 3000 Rows][1]
I have a dropdown on another page that has a cell for Name/Mode/Shift Listed on it and am creating a variable for each. For some reason when I change a field in a drop down, I get a '91' Object error. When I use a combination of all of the items in the dropdown that are in the 1st position, the macro works just fine. The issue is always when I change either the DC/Mode/Shift. DC is a string, Mode is a String, and Shift is an Integer.
Each Dim Search / Dim FindRow was it's own passthrough function but combined everything. Any help would be much appreciated!!!
Below is my code:
Sub DailyRouteInput_Button8_Click()
Dim DC As String
Worksheets("Daily Route Input").Activate
Range("U1").Select
DC = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
Mode = ActiveCell.Value
Range("C5").Select
Shift = ActiveCell.Value
Worksheets("Daily Route Master Data").Activate
(Was new passthrough function)
Dim SearchRange As Range
Dim FindRow As Range
Set SearchRange = Range("A2", Range("A2").End(xlUp))
Set FindRow = SearchRange.Find(What:=DC, LookIn:=xlValues, lookat:=xlWhole)
DC = FindRow.Row '---- Here is where the problem is ---------
Range("A" & DC).Offset(0, 1).Select
(Was new passthrough function)
Dim newSearchRange As Range
Dim newFindRow As Range
Set newSearchRange = Range("B" & DC, Range("B" & DC).End(xlUp))
Set newFindRow = newSearchRange.Find(Mode, LookIn:=xlValues, lookat:=xlWhole)
Mode = newFindRow.Row '---- Here is where the problem is ---------
Range("B" & Mode).Offset(0, 1).Select
(Was new passthrough function)
Dim finalNewSearchRange As Range
Dim finalNewFindRow As Range
Set finalNewSearchRange = Range("C" & Mode, Range("C" & Mode).End(xlUp))
Set finalNewFindRow = finalNewSearchRange.Find(Shift, LookIn:=xlValues, lookat:=xlWhole)
Shift = finalNewFindRow.Row '---- Here is where the problem is ---------
Range("C" & Mode).Offset(0, 1).Select
WeekCheck = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
MonthCheck = ActiveCell.Value