LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.misc
Bernie Deitrick
 
Posts: n/a
Default two-variable calculations continued ...

fredonic,

You need to do a lot for that, and it must be equation specific: Copy the code below, right click
on the sheet tab, select "View Code", and paste the code in the window that appears.

HTH,
Bernie
MS Excel MVP

Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Cells.Count 1 Then Exit Sub
If Intersect(Target, Range("A1:C1")) Is Nothing Then Exit Sub
If Target.Value = "" Then Exit Sub
If Application.WorksheetFunction.CountBlank(Range("A1 :C1")) < 1 Then Exit Sub

Application.EnableEvents = False
If Range("A1").Value = "" Then
Range("A1").Value = Range("C1").Value - Range("B1").Value
End If
If Range("B1").Value = "" Then
Range("B1").Value = Range("C1").Value - Range("A1").Value
End If
If Range("C1").Value = "" Then
Range("C1").Value = Range("A1").Value + Range("B1").Value
End If
Application.EnableEvents = True
End Sub



"fredonic" wrote in message
...
Could you be more specific, as I am still learning to program in excel.

"Gary''s Student" wrote:

Use a worksheet change event macro. It can detect two cells entered and
calculate the third, See:

http://www.mvps.org/dmcritchie/excel...m#wb_shtChange

--
Gary''s Student


"fredonic" wrote:

If I input a formula e.g. 'A1+B1=C1'; how do I tell excel to calculate B1 if
I have A1 and C1's values or A1 if I have the other 2 values - doing all this
using only the 3 original cells




 
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
object variable or with block variable not set Diego Excel Discussion (Misc queries) 1 August 9th 05 02:46 PM
why is it saying sheetcnt is "variable not defined" how to do a global variable to share over multiple functions in vba for excel? Daniel Excel Worksheet Functions 1 July 9th 05 03:05 AM
Calculations crossing multiple sheets Stephen McArthu Excel Discussion (Misc queries) 4 June 6th 05 04:35 PM
I Need VBA Assistance for global variable question Brent E Excel Discussion (Misc queries) 1 March 1st 05 08:46 PM
change function variable prompts?? thinkingfield Excel Worksheet Functions 1 November 8th 04 04:01 PM


All times are GMT +1. The time now is 12:30 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"