Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Elkar
 
Posts: n/a
Default formula in one cell or another

What you're asking can't be done with worksheet functions. A cell may
contain user input OR a calculated formula. Not both. However, you can
accomplish what you want with VB Code.

Open the VB Editor (Alt-F11) and add this code to the "ThisWorkbook" object.

Dim D, M As Double

Private Sub Workbook_Open()

D = Range("A1").Value
M = Range("B1").Value

End Sub

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)

If Range("A1").Value < D Then
D = Range("A1").Value
Range("B1").Value = Range("A1").Value / 8
Else:
If Range("B1").Value < M Then
M = Range("B1").Value
Range("A1").Value = Range("B1").Value * 8
End If
End If

End Sub


Hope that helps,
Elkar


"tjb" wrote:

When the user enters a number in cell A1, I want cell B1 to divide that
number by 8. If A1 is blank then B1 should be blank.

Alternately, when the user enters a number in cell B1, I want cell A1 to
MULTIPLY that number by 8. If B1 is blank then A1 should be blank.

I'm pretty sure this has to be a workbook function but I'm not sure how to
proceed. Any ideas all?

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
Urgent date/scheduling calc needed jct Excel Worksheet Functions 3 February 24th 06 01:36 AM
How do I set a cell value based on a formula in another cell? dingy101 Excel Discussion (Misc queries) 1 November 21st 05 08:51 AM
Possible Lookup Table Karen Excel Worksheet Functions 5 June 8th 05 09:43 PM
Creating a check mark box MarthaSue Setting up and Configuration of Excel 18 April 28th 05 12:31 AM
looking for a formula Amanda Excel Worksheet Functions 5 January 5th 05 07:37 AM


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