View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Colo Colo is offline
external usenet poster
 
Posts: 62
Default building a text string while looping though a worksheet

Me again, if you have a lot of data in the worksheet, using array makes code
faster.
I don't see your worksheet so it's not sure.. but which one is faster in
your case? :)

'---------------------------------------------------------------------------
-----
Dim MyHtm15 As String
Dim firstAddress As String
Dim buf As Variant
Dim i As Long
Dim c As Range

With Worksheets("New15Min")
.Activate
buf = .Range(.[A1], .[A65536].End(xlUp).Offset(, 6)).Value
End With
MyHtm15 = vbNullString: MyHtm15 = MyHtm15 & "</p"
With Columns(1)
Set c = .Find(Date, LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
For i = 1 To 7
MyHtm15 = MyHtm15 & buf(c.Row, i)
Next
MyHtm15 = MyHtm15 & "</p"
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address < firstAddress
End If
End With
Set c = Nothing

'---------------------------------------------------------------------------
-----


--
Kind Regards
Colo
/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
Colo of 'The Road of The Cell Masters' :)

URL:http://www.interq.or.jp/sun/puremis/...astersLink.htm


/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/