ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Find Function (https://www.excelbanter.com/excel-programming/340676-find-function.html)

reggie

Find Function
 
i used the find fuction in vba, but its case sensitive. How do make it not
case sensitive heres a sample of the code i have so far.

Set coolName = Worksheets("Promotional").Range("B4")
With Worksheets("USERS").Range("a1:a500")
Set c = .Find(coolName)

If c = coolName Then
Worksheets("Promotional").Range("g10").Value = "test"
c.Offset(columnOffset:=5) = "testing"
End If
End With


moondark[_2_]

Find Function
 

Code:
--------------------
Set coolName = Worksheets("Promotional").Range("B4")
With Worksheets("USERS").Range("a1:a500")
Set c = .Find(What:=coolName,MatchCase:=false)

If c = coolName Then
Worksheets("Promotional").Range("g10").Value = "test"
c.Offset(columnOffset:=5) = "testing"
End If
End With


--------------------


should work now ;)


--
moondark
------------------------------------------------------------------------
moondark's Profile: http://www.excelforum.com/member.php...o&userid=27390
View this thread: http://www.excelforum.com/showthread...hreadid=469423


reggie

Find Function
 
ok heres the problem now, it finds the data with no problems, but it wont put
in a specific value next to it(using the offset fuction):

sample code:

Set coolName = Worksheets("Promotional").Range("B4")
With Worksheets("USERS").Range("a1:a500")
Set c = .Find(What:=coolName,MatchCase:=false)


'----------this next part is what its not doing----------

If c = coolName Then
Worksheets("Promotional").Range("g10").Value = "test"
c.Offset(columnOffset:=5) = "testing"
End If
End With


"moondark" wrote:


Code:
--------------------
Set coolName = Worksheets("Promotional").Range("B4")
With Worksheets("USERS").Range("a1:a500")
Set c = .Find(What:=coolName,MatchCase:=false)

If c = coolName Then
Worksheets("Promotional").Range("g10").Value = "test"
c.Offset(columnOffset:=5) = "testing"
End If
End With


--------------------


should work now ;)


--
moondark
------------------------------------------------------------------------
moondark's Profile: http://www.excelforum.com/member.php...o&userid=27390
View this thread: http://www.excelforum.com/showthread...hreadid=469423




All times are GMT +1. The time now is 05:48 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com