Hey community,
I am using same VBA code ( to search from sheet1 ) and trying to use same code for sheet2 ( on multipages 2nd page ) i am copy-pasting same code and changing sheet name on second code. but for some reason it is not working on second paage of multipage.
i am getting error : Ambiguous name detected
or type does not focus error
I am using same VBA code ( to search from sheet1 ) and trying to use same code for sheet2 ( on multipages 2nd page ) i am copy-pasting same code and changing sheet name on second code. but for some reason it is not working on second paage of multipage.
i am getting error : Ambiguous name detected
Code:
Private Sub TextBox1_Change()
Dim fCell As Range, fCells As Range
Dim Firstfound As String
ListBox1.Clear
With Worksheets("Nom")
Set fCells = .Range("c1", .Range("c" & Rows.Count).End(xlUp))
End With
Set fCell = fCells.Find(What:=TextBox1.Value & "*", _
After:=fCells(fCells.Count), _
LookIn:=xlValues, _
Lookat:=xlWhole, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False)
If Not fCell Is Nothing Then
Firstfound = fCell.Address
Do
With ListBox1
.AddItem fCell.Value
.List(.ListCount - 1, 1) = fCell.Value
End With
Set fCell = fCells.FindNext(After:=fCell)
Loop While fCell.Address <> Firstfound
End If
End Sub
or type does not focus error