Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Efficient way of finding string and changing cell value

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
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
Finding the cell with a specified string Don Kline[_2_] Excel Worksheet Functions 4 March 31st 09 04:19 AM
Efficient way to drtermine if a string contains digits? [email protected] Excel Programming 15 August 29th 07 08:01 AM
Finding a string in a cell Mark Excel Programming 4 November 3rd 05 02:24 PM
Finding a string within a cell value peacelittleone[_2_] Excel Programming 6 August 5th 05 09:17 PM
Efficient STRING search with SpecialCells Ilan[_2_] Excel Programming 1 February 18th 04 01:49 PM


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