hi
i have a macro that i wish to change to search for different text. It currently searches for "mc20" but i want to be able to specify a variety of text like say "Mc542,"Mc13" can anyone help?
I have played around trying to use array and things to know avail. I am a excel novice any input would be gratefully received.
please see code below
i have a macro that i wish to change to search for different text. It currently searches for "mc20" but i want to be able to specify a variety of text like say "Mc542,"Mc13" can anyone help?
I have played around trying to use array and things to know avail. I am a excel novice any input would be gratefully received.
please see code below
Code:
Sheets("5 Axis List").Select
Range("A5:e100").Select
Selection.ClearContents
Range("g5:g100").Select
Selection.ClearContents
Dim r As Long
Dim Cell As Range
Dim FirstAddress As String
r = 5
With Worksheets("SHOP LOAD").Columns("f")
Set Cell = .Find(what:="[U]MC20[/U]", After:=.Cells(1, 1), LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows)
If Not Cell Is Nothing Then
FirstAddress = Cell.Address
Do
With Worksheets("5 Axis List")
.Range("C" & r).Value = Worksheets("SHOP LOAD").Cells(Cell.Row, 3).Value
.Range("B" & r).Value = Worksheets("SHOP LOAD").Cells(Cell.Row, 2).Value
.Range("A" & r).Value = Worksheets("SHOP LOAD").Cells(Cell.Row, 1).Value
.Range("d" & r).Value = Worksheets("SHOP LOAD").Cells(Cell.Row, 4).Value
.Range("E" & r).Value = Worksheets("SHOP LOAD").Cells(Cell.Row, 5).Value
.Range("g" & r).Value = Worksheets("SHOP LOAD").Cells(Cell.Row, 6).Value
.Range("o" & r).Value = Worksheets("SHOP LOAD").Cells(Cell.Row, 9).Value
End With
r = r + 1
Set Cell = .FindNext(Cell)
Loop While Cell.Address <> FirstAddress
End If
End With
Application.ScreenUpdating = True