Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help: Comparing two values
I have 2 numbers that I want to compare to each other.
The first number is in B4 and the second is in C4. The comparison wil be if C4 < B4 Then 'Do something how can I create a loop to perform this check on rows B4 through B2 and C4 through C24. so that each row will be compared. thanks in advanc -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Comparing two values
Hi Woknick,
Try: Sub test02() Dim cell As Range For Each cell In Range("C4:C24") If cell.Value cell.Offset(0, 1) Then 'Do something End If Next End Sub --- Regards, Norman "woknick " wrote in message ... I have 2 numbers that I want to compare to each other. The first number is in B4 and the second is in C4. The comparison will be if C4 < B4 Then 'Do something how can I create a loop to perform this check on rows B4 through B24 and C4 through C24. so that each row will be compared. thanks in advance --- Message posted from http://www.ExcelForum.com/ |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Comparing two values
Hi
one way: sub foo() dim i as integer for i = 4 to 24 with cells(i,2) if .value.offset(0,1).value then 'do something end if end with next end sub -- Regards Frank Kabel Frankfurt, Germany I have 2 numbers that I want to compare to each other. The first number is in B4 and the second is in C4. The comparison will be if C4 < B4 Then 'Do something how can I create a loop to perform this check on rows B4 through B24 and C4 through C24. so that each row will be compared. thanks in advance --- Message posted from http://www.ExcelForum.com/ |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Comparing two values
Hi,
Option Explicit Sub TEST() Dim CL As Range Dim i As Long For Each CL In Range("B4:B24") i = i + 1 If CL(i) CL(i, 2) Then 'Do something End If Next End Sub -- Regards, Soo Cheon Jheong _ _ ^ ^ V |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Help with Comparing values and retrieving values in Excel!!!!!! | Excel Worksheet Functions | |||
Comparing values between columns only when there are values in bot | Excel Worksheet Functions | |||
Comparing values | Excel Discussion (Misc queries) | |||
comparing two values | Excel Worksheet Functions | |||
Comparing Values | Excel Programming |