mysticmario
Active Member
- Joined
- Nov 10, 2021
- Messages
- 323
- Office Version
- 365
- Platform
- Windows
Hi, I have 365 file which cannot use activeX controls due to co-authoring issue. I have this piece of code where i used activex textbox to store value, which was then used in the subroutine to acheive search functionality. However now i can't seem to figure out how to replace
any idea how to replace
searchbar object(textbox)
with for example range("B2"
)
VBA Code:
Private Sub searchbar_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = vbKeyReturn Then
Call search_Click
searchbar.Activate
End If
End Sub
Sub search_Click()
Dim rngFound As Range
With ActiveSheet.Cells
Set rngFound = .Find(searchbar.Value, After:=ActiveCell _
, LookIn:=xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False)
If Not rngFound Is Nothing Then
rngFound.Select
Else
MsgBox prompt:="Not found"
End If
End With
End Sub
searchbar_KeyDown
object with range to maintain the saem functionality?