Question
I keep getting an error: Object Required but I can't figure out what's wrong. What are your suggestions to fix the error? The code is
I keep getting an error: "Object Required" but I can't figure out what's wrong. What are your suggestions to fix the error? The code is VBA
Sub GetResults() Dim no As Long Dim L1 As Long Dim P2 As Integer Dim so As Long Dim Tt1 As Long Dim voc As Long Dim Tt2 As Long Dim L2 As Long Dim Rh As Long Dim se As Long Dim Tt3 As Long Dim L3 As Long Dim Tc As Long Dim noc As Long Dim vs As Long
Set Range("no").Value = no *This is highlighted when the error message appears Set Range("L_1").Value = L1 Set Range("P").Value = P2 Set Range("so").Value = so Set Range("tt_1").Value = Tt1 Set Range("tt_2").Value = Tt2 Set Range("tt_3").Value = Tt3 Set Range("tc").Value = Tc Set Range("noc").Value = noc Set Range("Rh").Value = Rh Set Range("se").Value = se Set Range("L_2").Value = L2 Set Range("vs").Value = vs Set Range("voc").Value = voc Set Range("L_3").Value = L3 'Start Range("tt_1").Select Range("tt_1").Value = SheetFlowTravelTimeM(no, L1, P2, so, Tt1) Range("tt_2").Select Range("tt_2").Value = ShallowTravelTime(L2, vs, Tt2) Range("vs").Select If Range("I19:K19") = "Paved" Then Range("vs").Value = PavedM(ss, vp) ElseIf Range("I19:K19") = "Unpaved" Then Range("vs").Value = UnpavedM(ss, vu) End If Range("voc").Select Range("voc").Value = ManningsVelocityM(noc, Rh, se, voc) Range("tt_3").Select Range("tt_3").Value = OpenChannelTravelTime(L3, voc, Tt3) Range("Tc").Select Range("Tc").Value = TimeofConcenration(Tt1, Tt2, Tt3, Tc) End Sub 'Sheet (overland) flow Metric Function SheetFlowTravelTimeM(no, L1, P2, so, Tt1) SheetFlowTravelTimeM = [0.091*(n*L1)^0.8] / ((P2 ^ 0.5) * (s ^ 0.4)) End Function 'n = Manning's sheet flow roughness 'L1 = flow length in meters 'P2 = the 2yr 24hr rainfall in mm 's = the land slope in m/m 'Shallow concentrated flow Metric Function UnpavedM(ss, vu) UnpavedM = 4.91 * s ^ 0.5 End Function Function PavedM(ss, vp) PavedM = 6.19 * s ^ 0.5 End Function 'v = meters/second 's = the watercourse slope (m/m) Function ShallowTravelTime(L2, vs, Tt2) ShallowTravelTime = L2 / v End Function 'v is the average velocity (m/s) 's is the watercourse slope (m/m) 'L2 = Flow length 'Tt2 = travel time 2 'Open-Channel Flow Metric Function ManningsVelocityM(noc, Rh, se, voc) ManningsVelocityM = (1 / n) * (Rh ^ (2 / 3)) * se ^ (1 / 2) End Function 'Rh = meters Function OpenChannelTravelTime(L3, voc, Tt3) OpenChannelTravelTime = L3 / v End Function Function TimeofConcenration(Tt1, Tt2, Tt3, Tc) TimeofConcenration = Tt1 + Tt2 + Tt3 End Function
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started