Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Checking Cell Values Row-by-Row
I want to check the value in column M for each row and possibly change
the value in column F. Here's what I've written that works: Sub test() i = 2 Do Until i = 100 If Range("M:M").Cells(i).Text = "H" Then Range("F:F").Cells(i) = "H" i = i + 1 Loop End Sub Is there a better way to code this? Thanks for any help. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Checking Cell Values Row-by-Row
One way, a bit more efficient since it performs fewer range resolutions:
Public Sub test2() Dim rCell As Range For Each rCell In Range("M1:M100") With rCell If .Text = "H" Then .Offset(0, -7).Value = "H" End With Next rCell End Sub But for 100 cells, I wouldn't expect to see much difference in execution time. In article , (News Reader) wrote: I want to check the value in column M for each row and possibly change the value in column F. Here's what I've written that works: Sub test() i = 2 Do Until i = 100 If Range("M:M").Cells(i).Text = "H" Then Range("F:F").Cells(i) = "H" i = i + 1 Loop End Sub Is there a better way to code this? Thanks for any help. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Checking a column of values against another one | Charts and Charting in Excel | |||
Spell Checking with checking cell notes | Excel Discussion (Misc queries) | |||
Checking on two values | Excel Discussion (Misc queries) | |||
checking for missing values | Excel Programming | |||
checking values in a cel | Excel Programming |