ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help with search code (https://www.excelbanter.com/excel-programming/403276-help-search-code.html)

Mekinnik

Help with search code
 
I need some help in making this line of code search just the left 3
characters of column 'M' starting with cell 2-5000.'T' represents
CbxDept.text and column 'M' holds an alphanumeric number that is automaticlly
created so the first 2 to 3 characters are letters. This line is suppose to
find all the rows that match 'T' and setup to copy all the matching data to
another sheets to use as a report.

Sheets("ProCode").Columns(13).Find(What:=T, After:=Cells(5000, 13),
LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=True).Activate

Gary Keramidas

Help with search code
 
maybe this can get you started. post back with more details.

Option Explicit

Sub test()
Dim ws As Worksheet
Dim rngfound As Range
Set ws = Worksheets("ProCode")
With ws.Columns(13)
Set rngfound = .Find(What:="T", after:=Cells(5, 13), LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=True)
End With
MsgBox rngfound.Address
End Sub

--


Gary


"Mekinnik" wrote in message
...
I need some help in making this line of code search just the left 3
characters of column 'M' starting with cell 2-5000.'T' represents
CbxDept.text and column 'M' holds an alphanumeric number that is automaticlly
created so the first 2 to 3 characters are letters. This line is suppose to
find all the rows that match 'T' and setup to copy all the matching data to
another sheets to use as a report.

Sheets("ProCode").Columns(13).Find(What:=T, After:=Cells(5000, 13),
LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=True).Activate





All times are GMT +1. The time now is 01:55 AM.

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