Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Looping question | Excel Discussion (Misc queries) | |||
Looping Question | New Users to Excel | |||
Looping Question | Excel Discussion (Misc queries) | |||
looping question | New Users to Excel | |||
Looping question for 2 columns | Excel Programming |