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: 811
Default More efficient code

Hi Rohit,

Here's one way to do it:

Dim ecode As Range
Dim rngTable As Range
With ActiveSheet
Set rngTable = .Range(.Range("H4"), _
.Range("H65536").End(xlUp))
End With
For Each ecode In rngTable
With ecode
If Len(.Text) 0 Then
.Offset(, -3).Value = Sheets _
("Site Parameters").Range("N11").Value
End If
End With
Next ecode

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *


"Rohit Thomas" wrote in message
...
I have the following code to look through a range of cells
and populate another range if the text is not blank. My
code searches range H4:H201 everytime. Sometimes text may
only be in range H4:H20 or H4:H100. How can I make this
code more efficient to only look in the cells that have
text in column H starting with H4?

Dim ecode As Range
Range("H4:H110").Select
For Each ecode In Selection
With ecode
If Len(.Text) 0 Then
.Offset(, -3).Value = Sheets _
("Site Parameters").Range("N11").Value
End If
End With
Next ecode

Thanks,
Rohit



 
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
What's themost efficient way Rod Excel Worksheet Functions 2 December 30th 08 09:31 PM
Efficient linking teh_chucksta Excel Discussion (Misc queries) 3 April 18th 08 11:44 PM
IF and VLOOKUP - how efficient? anthonyg Excel Worksheet Functions 6 April 7th 07 08:45 AM
making code more efficient timmulla Excel Discussion (Misc queries) 3 January 23rd 07 02:16 PM
What is more efficient Brad Excel Discussion (Misc queries) 2 November 20th 06 09:13 PM


All times are GMT +1. The time now is 07:44 PM.

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"