LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 121
Default User Form Error Excel 2003!

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Display contents of a cell in a user form text box -- Excel 2003 VBA hiskilini Excel Discussion (Misc queries) 7 April 4th 23 10:22 AM
Closing Excel user form generates error Ken Warthen Excel Discussion (Misc queries) 0 October 10th 07 08:30 PM
User Form texbox insert text in cell - excel 2003 jfcby[_2_] Excel Programming 1 October 13th 06 06:08 PM
user form error 9 Craig[_24_] Excel Programming 1 October 14th 05 11:59 PM
User Form Error theguz Excel Discussion (Misc queries) 3 August 15th 05 10:49 PM


All times are GMT +1. The time now is 06:24 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"