Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
As amateur I would appreciate your help:
My sheet has 30 000 rows. In col D I need to find "district", not case sensitive, beeing part of a longer string. If true, value in col C should be set to "Dis". Using VBA, Excel 2003 - how can this be done in shortest possible time? Filter, Find, Search or ?? Thank you! |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Jan 24, 10:36*pm, ulfb wrote:
As amateur I would appreciate your help: My sheet has 30 000 rows. In col D I need to find "district", not case sensitive, beeing part of a longer string. If true, value in col C should be set to "Dis". Using VBA, Excel 2003 - how can this be done in shortest possible time? Filter, Find, Search or ?? Thank you! In C1, try =IF(ISERROR(SEARCH("district",D1)),"","Dis") |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
Try this Sub Dont_Dis_me() Dim LastRow As Long Dim MyRange As Range, C As Range Set sHt = Sheets("Sheet1") ' change to suit LastRow = sHt.Cells(Cells.Rows.Count, "D").End(xlUp).Row Set MyRange = sHt.Range("D1:D" & LastRow) For Each C In MyRange If InStr(1, C.Value, "District", vbTextCompare) 0 Then C.Offset(, -1).Value = "Dis" End If Next End Sub -- Mike When competing hypotheses are otherwise equal, adopt the hypothesis that introduces the fewest assumptions while still sufficiently answering the question. "ulfb" wrote: As amateur I would appreciate your help: My sheet has 30 000 rows. In col D I need to find "district", not case sensitive, beeing part of a longer string. If true, value in col C should be set to "Dis". Using VBA, Excel 2003 - how can this be done in shortest possible time? Filter, Find, Search or ?? Thank you! |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank you, works nicely!
/ulf "Mike H" wrote: Hi, Try this Sub Dont_Dis_me() Dim LastRow As Long Dim MyRange As Range, C As Range Set sHt = Sheets("Sheet1") ' change to suit LastRow = sHt.Cells(Cells.Rows.Count, "D").End(xlUp).Row Set MyRange = sHt.Range("D1:D" & LastRow) For Each C In MyRange If InStr(1, C.Value, "District", vbTextCompare) 0 Then C.Offset(, -1).Value = "Dis" End If Next End Sub -- Mike When competing hypotheses are otherwise equal, adopt the hypothesis that introduces the fewest assumptions while still sufficiently answering the question. "ulfb" wrote: As amateur I would appreciate your help: My sheet has 30 000 rows. In col D I need to find "district", not case sensitive, beeing part of a longer string. If true, value in col C should be set to "Dis". Using VBA, Excel 2003 - how can this be done in shortest possible time? Filter, Find, Search or ?? Thank you! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Finding the cell with a specified string | Excel Worksheet Functions | |||
Efficient way to drtermine if a string contains digits? | Excel Programming | |||
Finding a string in a cell | Excel Programming | |||
Finding a string within a cell value | Excel Programming | |||
Efficient STRING search with SpecialCells | Excel Programming |