Databases Reference
In-Depth Information
Function WithinSpec(RVal As Single) As Boolean
'Determines if Resistance Measurement is Within Spec
If RVal < OhmMin Or RVal > OhmMax Then
'Out of Specification
WithinSpec = False
Else
WithinSpec = True
End If
End Function
Sub ColorRangeBackground(wkbook, wksheet, cellrange, color)
'Colors the Background of a Range of Cells
'This subroutine WILL NOT WORK if the Sheet with the Selection
Range is not Active!
'Color Index Values: (Light Green = 35: Light Red = 9)
Workbooks(wkbook).Worksheets(wksheet).Activate
Workbooks(wkbook).Worksheets(wksheet).range(cellrange).Select
With Selection.Interior
.ColorIndex = color
.Pattern = xlSolid
End With
End Sub
The next two functions create coordinates that rotate clockwise around each gage.
Function RowCoord(ByVal index As Integer, ByVal row As Integer)
As Integer
If index > 2 Then
RowCoord = row + 1
Else
RowCoord = row
End If
End Function
Function ColCoord(ByVal index As Integer, ByVal col As Integer)
As Integer
If IsEven
(index) = True Then
ColCoord = col + 1
Else
ColCoord = col
End If
End Function
The IsEven and IsOdd functions are very handy and can be utilized in a variety of scenarios.
Function IsEven(ByVal lngNumber As Long) As Boolean
IsEven = (lngNumber \ 2 = lngNumber / 2)
End Function
Search WWH ::




Custom Search