What if question

Status
Not open for further replies.

leoj823

Board Regular
Joined
Aug 30, 2005
Messages
73
I need a formula to do the following. When I enter an x in f26 I need the figure in e26 to double. The name of the page is mileage form.
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Paste this code into your Sheet module...

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address <> "$F$26" Then Exit Sub
If Target.Cells.Count > 1 Then Exit Sub
Range("E26").Value = Range("E26").Value * 2
End Sub
 
Upvote 0
Hi,

Thank you for your prompt response. I'm afraid I don't know that much about Macros. Is there a formula that I could use for that cell and then drag it down to the cells below. I need to go from F26 to F47 to correspond to E26 to E47.

Leo
 
Upvote 0
Hi,

Thank you for your prompt response. I'm afraid I don't know that much about Macros. Is there a formula that I could use for that cell and then drag it down to the cells below. I need to go from F26 to F47 to correspond to E26 to E47.

Leo
 
Upvote 0
Jim doesn't appear to be on line at the moment so I'll have a go at answering this. No you cannot enter a formula which would do this, it will need to use the Worksheet_Change event as Jim has shown. To include all the other cells that you have identified you could use the following adaptation of Jim's code.

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Intersect(Range(Target.Address), Range("F26:F47")) Is Nothing Then
        Exit Sub
    Else
        If Target.Cells.Count > 1 Then
            Exit Sub
        Else
            Range("E" & Target.Row).Value = Range("E" & Target.Row).Value * 2
        End If
    End If
End Sub
 
Upvote 0
I need a formula to do the following. When I enter an x in f26 I need the figure in e26 to double. The name of the page is mileage form.

Where will the figure in E26 be drawn from? if you're manually entering it then your only solution is a VBA, like the one posted. If it's the result of a formula, then you could wrap that formula in an IF along the lines of =IF(F26="x",YourFormula*2,YourFormula)

An alternative if it's a manual entry would be for you to enter what would be going into E26 somewhere else, say for instance A26 as an example, then you could use a formula in E26 that says =IF(F26="x",A26*2,A26)
 
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,224,597
Messages
6,179,813
Members
452,945
Latest member
Bib195

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top