PC Review


Reply
Thread Tools Rate Thread

Change from Text to Value

 
 
Steved
Guest
Posts: n/a
 
      12th Aug 2009
Hello Steved

I would like to know please if it is possible to search for a value instead
off text.

I have over 700 entires and when I change "001" to text value it shows "1"

The below works as it should if I have cells as text


Sub Macro()

Dim varFound As Variant
Dim varSearch As Variant
Dim arrSearch As Variant
Dim strSearch As String

strSearch = InputBox("Type the string to be searched in Col C and D")
arrSearch = Split(strSearch & ",,", ",")

varSearch = arrSearch(0)

With Worksheets("Sheet1").Range("C:C")
Set varFound = .Find(varSearch, LookIn:=xlValues)
If Not varFound Is Nothing Then
firstAddress = varFound.Address
Do
If varFound.Offset(0, 1) = arrSearch(1) Then
varFound.Activate
If MsgBox(strSearch & " found at " & varFound.Address & _
vbLf & "Do you want to continue ?", vbYesNo) = vbNo Then Exit Sub
End If
Set varFound = .FindNext(varFound)
Loop While Not varFound Is Nothing And _
varFound.Address <> firstAddress
End If
End With

End Sub

Thankyou.

 
Reply With Quote
 
 
 
 
Mishell
Guest
Posts: n/a
 
      12th Aug 2009
Hi Steved

To search for the value, use LookIn:=xlFormulas instead of
LookIn:=xlValues.

Mishell


"Steved" <(E-Mail Removed)> wrote in message
news:AADB2BBE-2175-495B-94C5-(E-Mail Removed)...
> Hello Steved
>
> I would like to know please if it is possible to search for a value
> instead
> off text.
>
> I have over 700 entires and when I change "001" to text value it shows "1"
>
> The below works as it should if I have cells as text
>
>
> Sub Macro()
>
> Dim varFound As Variant
> Dim varSearch As Variant
> Dim arrSearch As Variant
> Dim strSearch As String
>
> strSearch = InputBox("Type the string to be searched in Col C and D")
> arrSearch = Split(strSearch & ",,", ",")
>
> varSearch = arrSearch(0)
>
> With Worksheets("Sheet1").Range("C:C")
> Set varFound = .Find(varSearch, LookIn:=xlValues)
> If Not varFound Is Nothing Then
> firstAddress = varFound.Address
> Do
> If varFound.Offset(0, 1) = arrSearch(1) Then
> varFound.Activate
> If MsgBox(strSearch & " found at " & varFound.Address & _
> vbLf & "Do you want to continue ?", vbYesNo) = vbNo Then Exit Sub
> End If
> Set varFound = .FindNext(varFound)
> Loop While Not varFound Is Nothing And _
> varFound.Address <> firstAddress
> End If
> End With
>
> End Sub
>
> Thankyou.
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Change background color in one text box based on text in 2nd text Gnerks Microsoft Access Reports 4 4th Aug 2008 02:52 PM
Change status bar text back to default 5 seconds after every change? sherifffruitfly Microsoft C# .NET 4 13th Nov 2006 10:59 PM
Don't change new message Attachment position when text type change =?Utf-8?B?QmlsbC1S?= Microsoft Outlook Discussion 1 3rd Aug 2005 01:42 AM
Change of text or background color doesn't change on the screen. =?Utf-8?B?U3VzYW4=?= Microsoft Excel Misc 5 29th Jul 2005 07:18 PM
Track change pasting as text without change in format tromoskaifobos Microsoft Word Document Management 1 4th Nov 2003 08:33 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:09 AM.