range().Find() Break issue

Maddhatter77057

New Member
Joined
Apr 20, 2009
Messages
9
Hello,

If possible i could use some help. Attached is the code to find a value within a named range. After finding the value (or not) code is then exicuted. The problem is that i get a code break window to occur after running the code. It always breads in the same three locations (the highlited sections). anyone know why? How do i get rid of it? The code exicutes and does what it's supposed to but i have to continue to press continue for it to complete. Let me know if there is anything else that i can post to help.


Sub inputFunction()
Dim x As Long
Dim y As Long
Dim g As Long
Dim h As Long
Dim i As Long
Dim CFSRows As Long
Dim WeibRows As Long
Dim letme As String
Dim checksb As Long
Dim findsb As Long
Dim isthere As Boolean
Dim remme As Long
Dim l As Long
Dim p As Long
Dim valueme As Long
Dim hoursrec As Long
Dim washere As Long
Dim remyou As Boolean
Dim findme As Long


On Error GoTo ErrHandle:
hoursrec = 11013820
Application.ScreenUpdating = False
Sheets("weibulls").Select
i = Range("ESN").Rows.count
Range("ESN").Copy
Range("A4").Select
ActiveSheet.Paste
Range("Operator").Copy
Range("B4").Select
ActiveSheet.Paste
Range("CT").Copy
Range("F4").Select
ActiveSheet.Paste
'**************************************
'**************************************
Range("ESN").Copy
Range("A" & i + 4).Select
ActiveSheet.Paste
Range("Operator").Copy
Range("B" & i + 4).Select
ActiveSheet.Paste
Range("CT").Copy
Range("F" & i + 4).Select
ActiveSheet.Paste
Sheets("weibulls").Select
y = Range("A65000").End(xlUp).row
washere = 1
For x = 4 To Range("Esn").Rows.count + 3
isthere = True
remyou = False
For g = 8 To Range("failmode").Rows.count + 7
Debug.Print Cells(1, g).Value
If Cells(1, g).Value <> "Weibull" Then
Debug.Print Range("Embodied").Find(Cells(x, 1).Value) Is Nothing
'**********************************************************************************************
'this needs to be fixed.
'**********************************************************************************************
If Range("Embodied").Find(Cells(x, 1).Value, Range("Embodied").Cells(1, 1)) Is Nothing = True Or isthere = False Then
MsgBox ("Was Here")
Else
findme = Range("Embodied").Find(Cells(x, 1).Value, Range("Embodied").Cells(1, 1)).row
isthere = False
End If

'**********************************************************************************************
'**********************************************************************************************
For l = findme To Range("embodied").Rows.count
Debug.Print Cells(x, 1).Value & " " & Range("Embodied").Cells(l, 1).Value
If Cells(x, 1).Value = Range("Embodied").Cells(l, 1).Value Then
Debug.Print Range("SBRates").Cells(g - 7, 3).Value & " " & Range("embodied").Cells(l, 2).Value
If Range("embodied").Cells(l, 2).Value = Range("SBRates").Cells(g - 7, 3).Value Then
If Range("Repair").Cells(g - 7, 1).Value = 1 Then
Cells(x, g).Value = 99999999
' washere = l
l = Range("embodied").Rows.count + l
Else
Value = (hoursrec / ((hoursrec / Cells(3, ColLetter(g)).Value) * (1 - Range("repair").Cells(g - 7, 3).Value)))
Cells(x, g).Formula = "=RiskWeibull(1, " & Value & ", RiskShift(-$F" & x & "), RiskTruncate($F" & x & ", ))"
' washere = l
l = Range("embodied").Rows.count + l
End If
End If
ElseIf Cells(x + 1, 1).Value = Range("Embodied").Cells(l, 1).Value Then
'washere = l
l = Range("embodied").Rows.count + l
letme = ColLetter(g)
Cells(x, g).Formula = "=RiskWeibull(1, " & letme & "$3, RiskShift(-$F" & x & "), RiskTruncate($F" & x & ", ))"
End If
Next l
Else
MSGbox("Hello"
End if
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce

Forum statistics

Threads
1,214,415
Messages
6,119,382
Members
448,889
Latest member
TS_711

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top