Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Note here that with Rick's solution, I hadn't put in conditional
formatting yet. This is really quite easy, the tough part was getting the max/min (or high/low) to get a correct readout. I still need to sit down and look at the code to understand it. Maybe I'll try to think of some similar type program to write and try out to test myself afterwards. Regardless, in the future a question or two may come, but for now, here's Rick's solution laid out. ------ Rick's SOLUTION Style -------- Sub RCVV_WP() Dim TeishutsuItemRow As Long Dim TeishutsuItemColumn As Long Dim PrevXTIR As Long Dim PrevYTIR As Long Dim PrevLTIR As Long Dim SokuteiPointNumber As Long Dim HighestPointNumber As Long Dim SolutionTolerance As Long Dim ToleranceString As String Dim ToleranceValue As String Dim LValueBase As String Dim TempLoop As Long Const Separator1 = "/" Const Separator2 = "¡Ó" Const StanleyText = " ST " Const NumericCharacters = "+-0123456789" Dim Position As Integer Dim High As String Dim Low As String ' SET THE VARIABLES FOR TEISHUTSUROW AND COLUMN. ' ALSO SET PREVIOUS X,Y,L ITEM ROWS IN THE EVENT REPEATED (BLANK) TOLERANCE ENTRY. ' SOKUTEI AND HIGHEST POINT NUMBERS SET TO 1. TeishutsuItemRow = 3 TeishutsuItemColumn = 8 PrevXTIR = 0 PrevYTIR = 0 PrevLTIR = 0 SokuteiPointNumber = 1 HighestPointNumber = 1 For TempLoop = 3 To 300 If Sheets("´£¥X¥Î").Cells(TempLoop, TeishutsuItemColumn + 1).Value HighestPointNumber Then HighestPointNumber = Sheets("´£¥X¥Î").Cells(TempLoop, TeishutsuItemColumn + 1).Value End If Next TempLoop 'MsgBox "HighestPointNumber = " & (HighestPointNumber) ' LOOP FOR ALL SOKUTEI POINTS. Do Until SokuteiPointNumber = HighestPointNumber + 1 ' RESET VALUES FOR TOLERANCE ToleranceValue = "" ' FIRST MATCH UP SOKUTEI POINT WITH ROW ON ´£¥X¥Î SHEET, AND SOLVE FOR XYL TOLERANCES. For TempLoop = 0 To 2 ToleranceString = Sheets("´£¥X¥Î").Cells(TeishutsuItemRow, TeishutsuItemColumn + 2 + TempLoop).Value MsgBox "ToleranceString = " & (ToleranceString) High = MaxTol(ToleranceString) Low = MinTol(ToleranceString) MsgBox "High = " & (High) MsgBox "Low = " & (Low) Next TempLoop Loop End Sub Function MaxTol(VarTol As String) As Variant Dim Parts() As String On Error GoTo BadFormat If VarTol Like "* [Ss][Tt] *" Then MaxTol = CDbl(Split(VarTol, "ST", , vbTextCompare)(1)) Exit Function End If If VarTol Like "* ¡Ó*" Then Parts = Split(VarTol, "¡Ó") MaxTol = CDbl(Parts(0)) + CDbl(Parts(1)) Exit Function End If If VarTol Like "* */*" Then MaxTol = CDbl(Split(VarTol)(0)) + CDbl(Split(Split(VarTol)(1), "/") (0)) Exit Function End If BadFormat: MaxTol = "#BADFORMAT!" End Function Function MinTol(VarTol As String) As Variant Dim Parts() As String On Error GoTo BadFormat If VarTol Like "* [Ss][Tt] *" Then MinTol = CDbl(Split(VarTol, "ST", , vbTextCompare)(1)) Exit Function End If If VarTol Like "* ¡Ó*" Then Parts = Split(VarTol, "¡Ó") MinTol = CDbl(Parts(0)) - CDbl(Parts(1)) Exit Function End If If VarTol Like "* */*" Then MinTol = CDbl(Split(VarTol)(0)) + CDbl(Split(Split(VarTol)(1), "/") (1)) Exit Function End If BadFormat: MinTol = "#BADFORMAT!" End Function |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Finding Cell that changes from a Positive to a Negitive number | Excel Worksheet Functions | |||
Sum x number of right cells after finding first cell more than 0. | Excel Worksheet Functions | |||
Finding the Row number based on contents of a cell | Excel Worksheet Functions | |||
finding a particular cell in another worksheet whose row number ch | Excel Discussion (Misc queries) | |||
Page Number inside Cell? | Excel Discussion (Misc queries) |