Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Comparing two Cells - using Offset and compare - Stuck!!!!

What is the easist way to compare the values of two adjacent cells? I need to check the value of the active cell and the cell to the right of it (i can use the offset for that). If the numerical value of the cell to the right is greater, than I trigger an alert. Simple stuff, but I am not totally sure how to define the cell to the right using the offset and then compare the values. Any help would be greatly appreciated. Thank you

Dou

Example
If A1 is less than B1 (A1 < B1) then I show a user form
The active cell in this case would be A1. I need to figure out code to calculate the offset (to B1) and then compare the values. Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default Comparing two Cells - using Offset and compare - Stuck!!!!

Doug,

Sub testit()
Dim rng As Range

Set rng = Range("A1")

If rng.Value < rng.Offset(0, 1).Value Then
MsgBox "show form"
End If
End Sub

Rob

"Doug" wrote in message
...
What is the easist way to compare the values of two adjacent cells? I need

to check the value of the active cell and the cell to the right of it (i can
use the offset for that). If the numerical value of the cell to the right is
greater, than I trigger an alert. Simple stuff, but I am not totally sure
how to define the cell to the right using the offset and then compare the
values. Any help would be greatly appreciated. Thank you.

Doug

Example:
If A1 is less than B1 (A1 < B1) then I show a user form.
The active cell in this case would be A1. I need to figure out code to

calculate the offset (to B1) and then compare the values. Thanks.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Comparing two Cells - using Offset and compare - Stuck!!!!

if ActiveCell.Value < ActiveCell.offset(0,1).Value then _
userform1.show

--
Regards,
Tom Ogilvy

Doug wrote in message
...
What is the easist way to compare the values of two adjacent cells? I need

to check the value of the active cell and the cell to the right of it (i can
use the offset for that). If the numerical value of the cell to the right is
greater, than I trigger an alert. Simple stuff, but I am not totally sure
how to define the cell to the right using the offset and then compare the
values. Any help would be greatly appreciated. Thank you.

Doug

Example:
If A1 is less than B1 (A1 < B1) then I show a user form.
The active cell in this case would be A1. I need to figure out code to

calculate the offset (to B1) and then compare the values. Thanks.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Comparing two Cells - using Offset and compare - Stuck!!!!

Rob/Tom

Thank you so much. That worked like a charm

Doug
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
Stuck! Moving cells to the right Rubanski Excel Discussion (Misc queries) 3 February 28th 09 12:03 AM
Compare Cell Values, Offset(-1,0), Offset(-1,-1), and xlFillDefaul RyGuy Excel Worksheet Functions 2 September 28th 07 10:54 PM
Compare side by side stuck Rh+ Excel Worksheet Functions 3 July 31st 07 10:58 PM
comparing two spreadsheets using vlookup and compare Sweetetc Excel Worksheet Functions 6 September 14th 06 08:25 AM
How do I compare cells and if FALSE compare to next cell in EXCEL Cindie Excel Worksheet Functions 0 March 24th 06 05:29 PM


All times are GMT +1. The time now is 06:05 PM.

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"