Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Looping Question?


How to loop through the range B:H from row 5 until the end?
I like to have the value show up in the message board like current row
no = 5 current cell = 5b current value = 8, somethings like this.

Hopefully I can get the answer for the above question.

Thanks.


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Looping Question?

Sub Tester1()
For Each rw In Range(Cells(5, 2), _
Cells(Rows.Count, 2).End(xlUp))
For Each cell In rw.Resize(1, 7)
Application.StatusBar = "Current Row No = " & rw.Row _
& " Current Cell = " & cell.Address(0, 0) & _
" Current Value = " & cell.Value
For i = 1 To 1000000
dblval = dblval + 1
Next
Next
Next
Application.StatusBar = False
End Sub


the loop For i = 1 to 1000000
represents the processing you would do on each cell. Right now, it just
slows the macro down, otherwise, it runs so fast you can't see the results.
So, you would replace that portion with the processing you are performing.

--
Regards,
Tom Ogilvy




"Michael168" wrote in message
...

How to loop through the range B:H from row 5 until the end?
I like to have the value show up in the message board like current row
no = 5 current cell = 5b current value = 8, somethings like this.

Hopefully I can get the answer for the above question.

Thanks.


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Looping Question?

the following procedure gives a simple demo...

Sub demo()

Dim rSource As Range ' the area to be "viewed"
Dim rCell As Range ' for looping through the view
Dim msg As String ' body of the message
Dim title As String 'tile of the message

Set rSource = Range("D5:H15")

For Each rCell In rSource

' initialise message variables
title = "row: %R"
msg = "Address: %A " & Chr(10) & "Value: %V"

' populate message variables
title = Replace(title, "%R", rCell.Row)
msg = Replace(msg, "%A", rCell.Address)
msg = Replace(msg, "%V", rCell.Value)

' show message & test for user cancel
If MsgBox(msg, vbOKCancel, title) = _
vbCancel Then
Exit For
End If

Next


End Sub

Patrick Molloy
Microsoft Excel MVP
-----Original Message-----

How to loop through the range B:H from row 5 until the

end?
I like to have the value show up in the message board

like current row
no = 5 current cell = 5b current value = 8, somethings

like this.

Hopefully I can get the answer for the above question.

Thanks.


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from

http://www.ExcelForum.com/

.

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
Looping question Jase Excel Discussion (Misc queries) 2 March 19th 08 02:03 PM
Looping Question lee New Users to Excel 3 August 4th 06 04:23 PM
Looping Question MWS Excel Discussion (Misc queries) 1 June 5th 06 07:23 PM
looping question luke New Users to Excel 4 June 3rd 05 01:19 PM
Looping question for 2 columns [email protected] Excel Programming 1 October 24th 03 02:33 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"