Save hours in development time and avoid common mistakes by learning the best practices to use for JavaScript.

Excel 2007

Have a number of columns I need automatically updated when inserting a value into Col i which is a summed value from

amounts in Col G.

Here's what I need to happen when the amount from col G is summed into Col i:

- duplicate that amount in Col U

- input 1.4 into Col V

- adjust col V's amount by multiplying it times 5% and put that adjusted amount in Col W

- add col V to col W and insert that sum into Col X

- take Col U's value divide it by Col X's value and insert that figure into Col Y

- take Col Y multiply it by 7.5% and put that value into Col Z

- take Col Y's value and apply this formula to it: =IF(Y547*7.5%<75, Y547-75, Y547-(Y547*7.5%)) and

insert that Value into Col T

- Finally, in Col S, input EUR

Attached is an example spreadsheet that does just that but only by pull-down copying. Book4.xls

Have a number of columns I need automatically updated when inserting a value into Col i which is a summed value from

amounts in Col G.

Here's what I need to happen when the amount from col G is summed into Col i:

- duplicate that amount in Col U

- input 1.4 into Col V

- adjust col V's amount by multiplying it times 5% and put that adjusted amount in Col W

- add col V to col W and insert that sum into Col X

- take Col U's value divide it by Col X's value and insert that figure into Col Y

- take Col Y multiply it by 7.5% and put that value into Col Z

- take Col Y's value and apply this formula to it: =IF(Y547*7.5%<75, Y547-75, Y547-(Y547*7.5%)) and

insert that Value into Col T

- Finally, in Col S, input EUR

Attached is an example spreadsheet that does just that but only by pull-down copying. Book4.xls

Experts Exchange Solution brought to you by

Enjoy your complimentary solution view.

Get every solution instantly with Premium.
Start your 7-day free trial.

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Sample attached?

```
Dim rng As Range, aCell As Range
Dim i As Long
If Not Intersect(Target.Dependents, Columns(9)) Is Nothing Then
Application.EnableEvents = False
For Each rng In Range(Target.Dependents.Address)
If rng.Column = 9 Then
i = Range(rng.Address).Row
Range("U" & i).Formula = "=" & rng.Address
Exit For
End If
Next rng
If i = 0 Then Exit Sub
Range("V" & i).Value = 1.4
Range("W" & i).Formula = "=" & Range("V" & i).Address & "*5%"
Range("X" & i).Formula = "=" & Range("V" & i).Address & "+" & Range("W" & i).Address
Range("Y" & i).Formula = "=" & Range("U" & i).Address & "/" & Range("X" & i).Address
Range("Z" & i).Formula = "=" & Range("Y" & i).Address & "*7.5%"
Range("T" & i).Formula = "=IF(Y" & i & "*7.5%<75, Y" & i & "-75, Y" & i & "-(Y" & i & "*7.5%))"
Range("S" & i).Value = "EUR"
Application.EnableEvents = True
End If
End Sub
```

Book4.xls

Try this

```
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range, aCell As Range
Dim i As Long
On Error Resume Next
If Not Intersect(Target.Dependents, Columns(9)) Is Nothing Then
Application.EnableEvents = False
For Each rng In Range(Target.Dependents.Address)
If rng.Column = 9 Then
i = Range(rng.Address).Row
Range("U" & i).Formula = "=" & rng.Address
Exit For
End If
Next rng
If i = 0 Then Exit Sub
Range("V" & i).Value = 1.4
Range("W" & i).Formula = "=" & Range("V" & i).Address & "*5%"
Range("X" & i).Formula = "=" & Range("V" & i).Address & "+" & Range("W" & i).Address
Range("Y" & i).Formula = "=" & Range("U" & i).Address & "/" & Range("X" & i).Address
Range("Z" & i).Formula = "=" & Range("Y" & i).Address & "*7.5%"
Range("T" & i).Formula = "=IF(Y" & i & "*7.5%<75, Y" & i & "-75, Y" & i & "-(Y" & i & "*7.5%))"
Range("S" & i).Value = "EUR"
Application.EnableEvents = True
End If
On Error GoTo 0
End Sub
```

Sid

uhhh.... nothing happens.

FYI: I sum col H into i: =SUM(H13:H23)

but when I do that, nothing happens

FYI: I sum col H into i: =SUM(H13:H23)

but when I do that, nothing happens

I created the formula first in Cell I13 and then copied and pasted the values into H13:H23

The macro ran just fine.

Sid

Here's the way I need it to work:

- I paste amounts in Col H (H13 - H23 for example)

- Sum those amounts into Col i (i 13)which

- initiates the code and populates the rest of the row 13 as indicated above

As you can see the page is divided up into sections so each section would work as described.

Am I making sense?

Please see snapshot.

Sid

Untitled.jpg

I've tried it your way by placing the formula in i 13 first, but it didn't do anything.

I tried it the way I need to do it which is paste in values in col H and then sum the values in col i and when it sums those to go ahead and kick off your code. However, in either way it is not working.

Now what?

Sample File attached.

.

Please see screencast.

Hope it helps.

Sid

SiddharthRout-441908.flv

Book4.xls

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trialClose Excel completely.

Open the file that I posted above

Paste this code in a module and run it

```
Sub Sample
application.screenupdating=true
end sub
```

Now try it.

Sid

ps: I might or might not be able to reply to your posts as Things are getting packed right now.

But how I want it to work is like this:

1. I paste the values into col H44 - H47 (for example)

2. Sum the values from col H44 - H47 into col i44 (=SUM(H44:H47))

and that should kick off the code and populate the row but it doesn't work when I do it that way.

Only if I go through the gymnastics outlined above.

I will incorporate the changes for I column.

Sid

Thanks you.

Microsoft Excel

From novice to tech pro — start learning today.

Experts Exchange Solution brought to you by

Enjoy your complimentary solution view.

Get every solution instantly with Premium.
Start your 7-day free trial.

You mean H into I?

Sid