LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Comparing values in cell B to cell A

Hello

What I want to do:
If any row in col B is empty do nothing, but if a number is entered in any row of col B, immediately calculate a
difference of what is in column A to B

What Im trying to do: (if this is the right thinking)
Im trying to read the address of B and make a calculation (the difference) by reading the value from col A in the same
row, but not sure exactly how to reference col A after reading col B:
User enters value in col b, the number is read, and somehow the address is read in col A, and then value is read in A
and difference is taken.

Any help is greatly appreciated

Susan


Private Sub Worksheet_Change(ByVal Target As Range)

Application.EnableEvents = False
On Error GoTo ws_exit
If Not Intersect(Target, Range("b1..b1000")) Is Nothing Then
With Target

Dim rng As Range
Set rng = ActiveCell
Dim generalvalue

Dim generalrng As Range
generalrng = rng(0, 0)
genralvalue = generalrng.Value

If .Value < generalvalue Then '.Address(0, 1) Then
.value<generalvalue

End If

End With
End If
ws_exit:
Application.EnableEvents = True

End Sub






 
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
Conditional Formatting: comparing cell values Coco212 Excel Worksheet Functions 0 April 1st 10 09:44 PM
Question about comparing 2 cell values mCassidy Excel Discussion (Misc queries) 3 May 16th 07 09:37 PM
Comparing multiple cell values scoobydoo2006 Excel Discussion (Misc queries) 0 June 13th 06 04:58 PM
Counting values and comparing them to a single cell Tbentsen Excel Discussion (Misc queries) 3 August 4th 05 10:47 PM
Comparing cell values Touk Excel Programming 3 September 29th 04 11:04 AM


All times are GMT +1. The time now is 05:18 AM.

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

About Us

"It's about Microsoft Excel"