-
try
[vba]
Private Sub CommandButton1_Click()
'Use PO# format to change BRICE to BRICE TOOL or BRICE SEAT
Dim StrtAdrss As String
Dim Found As Range
Dim stringToFind
Dim Rng As Range
Dim LastRow As Long
stringToFind = "BRICE"
StrtAdrss = ActiveCell.Address
With ActiveSheet
LastRow = .Cells.SpecialCells(xlCellTypeVisible).Find("*", SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious).Row
Set Rng = .Range(.Cells(16, 1), .Cells(LastRow, 5)).SpecialCells(xlCellTypeVisible)
End With
If ActiveCell.Row > 15 Then
ActiveCell.EntireRow.Cells(3).Activate
Set Found = Rng.Find(What:=stringToFind, _
After:=ActiveCell, _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not Found Is Nothing Then
' match was found
confirm = MsgBox("Make changes?", vbYesNo)
If confirm = vbYes Then
If InStr(Found.EntireRow.Cells(5).Value, ".") >= 1 _
Or InStr(Found.EntireRow.Cells(5).Value, "-") >= 1 _
Or InStr(Found.EntireRow.Cells(5).Value, "RGB") >= 1 Then
Found.EntireRow.Cells(3).Value = "BRICE TOOL"
Else
Found.EntireRow.Cells(3).Value = "BRICE SEAT"
End If
D:
Do Until Found.Row > 15 And StrtAdrss <> Found.Address
Set Found = Rng.FindNext(Found)
Loop
ActiveWindow.ScrollRow = Found.Row - 5
Found.EntireRow.Cells(5).Activate
Else
GoTo D:
End If
Else
MsgBox "No Match Found"
End If
Else
MsgBox "Please select a row greater than 15"
End If
End Sub
[/vba]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules