will2learn
Board Regular
- Joined
- Dec 1, 2005
- Messages
- 144
I'm experiencing a problem when a number is typed into the input box. Is there anyway to force the entry to be read as text?
Code:
Private Sub OptionButton4_Click()
Dim Na
Dim Rng As Range
Dim F As Range
Dim FirstAddress As String
Dim R As Long
Dim LastRow As Long
Na = InputBox("Job Number")
If Na = "" Then Exit Sub
Set Rng = Range("DutyID")
Set F = Rng.Find(What:=Na, After:=Rng.Cells(Rng.Rows.Count, Rng.Columns.Count))
If Not F Is Nothing Then
Sheets("Data").Select
LastRow = Range("A65536").End(xlUp).Row
Range("A1:AF1").Select
Selection.AutoFilter
Application.CutCopyMode = False
Range("A2:AF" & LastRow).Select
Selection.AutoFilter Field:=6, Criteria1:="=" & Na, Operator:=xlAnd
Selection.ClearContents
Selection.AutoFilter
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Worksheets("Data").AutoFilterMode = False
Sheets("Data").Select
LastRow = Range("A65536").End(xlUp).Row
Range("BX1:BZ1").Select
Selection.AutoFilter
Application.CutCopyMode = False
Range("BX2:BX" & LastRow).Select
Selection.AutoFilter Field:=1, Criteria1:="=" & Na, Operator:=xlAnd
Selection.ClearContents
Selection.AutoFilter
Selection.Sort Key1:=Range("BX2"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Worksheets("Data").AutoFilterMode = False
Sheets("Data").Select
LastRow = Range("A65536").End(xlUp).Row
Range("CB1:CF1").Select
Selection.AutoFilter
Application.CutCopyMode = False
Range("CB2:CF" & LastRow).Select
Selection.AutoFilter Field:=2, Criteria1:="=" & Na, Operator:=xlAnd
Selection.ClearContents
Selection.AutoFilter
Selection.Sort Key1:=Range("CC2"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Worksheets("Data").AutoFilterMode = False
Sheets("StartScreen").Select
Else
MsgBox ("Not found")
End If
End Sub