W
wayne
The folowing code was supplied by Dave Paterson....Many
Thanks
I Can only get this code to work when I replace "sheet1"
with the actual sheet tab name ie "BOM Summary file1"
As the "sheet tab name" changes for each job / file why
shouldn't "Sheet1" overide the tab name????
Am I doing something wrong???
Option Explicit
Sub testme01()
Dim FoundCell As Range
Dim FirstAddress As String
Dim FindWhat As String
FindWhat = "109000"
With Worksheets("sheet1").Range("a:a")
Set FoundCell = .Cells.Find(what:=FindWhat, _
after:=.Cells(.Cells.Count), _
LookIn:=xlFormulas, lookat:=xlWhole)
If FoundCell Is Nothing Then
'do nothing
Else
FirstAddress = FoundCell.Address
Do
FoundCell.Offset(0, 1).Value = 0
Set FoundCell = .FindNext(FoundCell)
Loop While Not FoundCell Is Nothing _
And FoundCell.Address <> FirstAddress
End If
End With
End Sub
Thanks
I Can only get this code to work when I replace "sheet1"
with the actual sheet tab name ie "BOM Summary file1"
As the "sheet tab name" changes for each job / file why
shouldn't "Sheet1" overide the tab name????
Am I doing something wrong???
Option Explicit
Sub testme01()
Dim FoundCell As Range
Dim FirstAddress As String
Dim FindWhat As String
FindWhat = "109000"
With Worksheets("sheet1").Range("a:a")
Set FoundCell = .Cells.Find(what:=FindWhat, _
after:=.Cells(.Cells.Count), _
LookIn:=xlFormulas, lookat:=xlWhole)
If FoundCell Is Nothing Then
'do nothing
Else
FirstAddress = FoundCell.Address
Do
FoundCell.Offset(0, 1).Value = 0
Set FoundCell = .FindNext(FoundCell)
Loop While Not FoundCell Is Nothing _
And FoundCell.Address <> FirstAddress
End If
End With
End Sub