Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello,
I'm tring to create a User Form to select a range and find data within cells in the selected range. But I'm getting this error message Run-time error '13' Type mismatch then it highlights this part of the code: SelRange(oSearch.Address).Activate ' or whatever How can the code be changed work without errors? The complete code: Private Sub CommandButton1_Click() Dim SelRange As Range Dim Addr As String Dim oSearch As Object Dim sFind As String 'Get the address, or reference, from the RefEdit control. Addr = RefEdit1.Value 'Set the SelRange Range object to the range specified in the 'RefEdit control. Set SelRange = Range(Addr) 'Apply a red pattern to the SelRange. 'SelRange.Interior.ColorIndex = 3 'Finds the information sFind = TextBox1.Value 'InputBox("Enter search criteria:", "Data") With SelRange 'ActiveSheet.Range("D2:D24000") Set oSearch = .Find(sFind, , xlValues) If Not oSearch Is Nothing Then SelRange(oSearch.Address).Activate ' or whatever Else MsgBox "No match could be found" End If End With 'Unload the userform. Unload Me End Sub Thanks in advsnce for your help, James Cooper |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Display contents of a cell in a user form text box -- Excel 2003 VBA | Excel Discussion (Misc queries) | |||
Closing Excel user form generates error | Excel Discussion (Misc queries) | |||
User Form texbox insert text in cell - excel 2003 | Excel Programming | |||
user form error 9 | Excel Programming | |||
User Form Error | Excel Discussion (Misc queries) |