Hi
I'm having trouble using VBA's Find function.
I have a worksheet which holds a concatenation of AppID's and App Names in Column U. There are approximately 12,000 rows and each cell in Column U holds one of either of the following value formats:
242 - Application 1
242 - Application 1; 1845 - Application 2
242 - Application 1, 1845 - Application 2; 34678 - Application 3
etc...
I need to find all instances of a chosen App ID and then copy any row in which the App ID appears to a new sheet (to obtain the chosen AppID I am presenting a list of those to the user in a form Listbox, and I know the selection ofthe AppID is functioning as I am currently presenting it in a MsgBox prior to running this part of the code).
When I run a manual FindAll on a given AppID it returns all the cells in Column U which that AppID appears, but when I use the following code to achieve the same it does not seem to find the AppID's.
(NB - I've "borrowed" this code from a posting on Ozgrid, but I have also compared it to the many other FindAll methods available on the web and they all apppear to be pretty similar).
(The changing of the cells interior colour is just a way of identifying whether it's working prior to writing the code to copy the row ino a new sheet).
I've been trying to get this to work for over a day now and it's driving me mad so any help is reatly appreciated.
Thanks
Shane
I'm having trouble using VBA's Find function.
I have a worksheet which holds a concatenation of AppID's and App Names in Column U. There are approximately 12,000 rows and each cell in Column U holds one of either of the following value formats:
242 - Application 1
242 - Application 1; 1845 - Application 2
242 - Application 1, 1845 - Application 2; 34678 - Application 3
etc...
I need to find all instances of a chosen App ID and then copy any row in which the App ID appears to a new sheet (to obtain the chosen AppID I am presenting a list of those to the user in a form Listbox, and I know the selection ofthe AppID is functioning as I am currently presenting it in a MsgBox prior to running this part of the code).
When I run a manual FindAll on a given AppID it returns all the cells in Column U which that AppID appears, but when I use the following code to achieve the same it does not seem to find the AppID's.
(NB - I've "borrowed" this code from a posting on Ozgrid, but I have also compared it to the many other FindAll methods available on the web and they all apppear to be pretty similar).
(The changing of the cells interior colour is just a way of identifying whether it's working prior to writing the code to copy the row ino a new sheet).
Code:
Dim temp2WS as Worksheet
Set temp2WS = ThisWorkBook.Worksheets("AppID")
Dim lCount As Long
Dim rFoundCell As Range
Set rFoundCell = temp2WS.Range("U1")
temp2WS.Activate
rFoundCell.Select
For lCount = 1 To iTemp
Set rFoundCell = Columns("U:U").Find(What:=vID, After:=rFoundCell, LookIn _
:=xlValues, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection _
:=xlNext, MatchCase:=False, SearchFormat:=False)
With rFoundCell
.Interior.ColorIndex = RGB(255, 55, 55)
End With
Next lCount
I've been trying to get this to work for over a day now and it's driving me mad so any help is reatly appreciated.
Thanks
Shane