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: 62
Default Find MatchCase problem



I am using MatchCase:=False , but below coding can not able to find
040x in Worksheet.

In target worksheet have cc code 040X, I can not able to using 040x to
found target cc code 040X .


Do you know why ?
I also try LookIn:=xlvalue
Set c = (loSheet.Columns("A:A").Find(What:=loString,
After:=loSheet.Range("A1"), _
LookIn:=xlvalue, LookAt:=xlWhole, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False, MatchByte:=False))


Sub test_SearchCC()
Dim a As Integer
a = Search_CC("040x")
MsgBox "Result row value is " & a
End Sub


Function Search_CC(loString As String) As Integer
'~~ Find Cost Ctr
Dim c
Dim FirstAddress
Dim myPos As Integer
Dim result As Integer
Dim loSheet As Worksheet
Dim loWorkbook As Workbook
Set loWorkbook = Application.Workbooks(Account.getAccWSheet)
Set loSheet = loWorkbook.Sheets(Account.getCC)


'
' Cells.Find(What:="040X", After:=ActiveCell,
LookIn:=xlFormulas, LookAt _
' :=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
' False).Activate


Set c = (loSheet.Columns("A:A").Find(What:=loString,
After:=loSheet.Range("A1"), _
LookIn:=xlFormulas, LookAt:=xlWhole, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False, MatchByte:=False))


If Not c Is Nothing Then
FirstAddress = c.Address
myPos = InStr(2, FirstAddress, "$")
result = VBA.Mid(FirstAddress, myPos, VBA.Len(FirstAddress))
'~~ MsgBox "found " & FirstAddress & " " & Result
Search_CC = result


Else
Search_CC = 0
End If
End Function

 
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
Find MatchCase problem moonhk Excel Programming 0 October 26th 06 07:21 AM
Find and Find Next problem Richard Hocking Excel Programming 2 September 13th 06 03:51 PM
MatchCase syntax? teeb Excel Discussion (Misc queries) 2 May 5th 06 11:51 AM
find problem jon Excel Programming 2 May 24th 04 11:27 AM
Problem with FIND LSB Excel Programming 2 January 12th 04 04:16 AM


All times are GMT +1. The time now is 11:18 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"