Make the worksheet dynamic

kvemperor

New Member
Joined
Jan 13, 2023
Messages
31
Office Version
  1. 2021
Platform
  1. Windows
sample.jpg

In this worksheet i have the function in cell G9 =B9+G8-E9 so every time i am putting a value in the column B or in the column E then when i drag down the cell (of the same row)in the column G then i have my result.Is it possible this to make it dynamic?(with vba or any other way? i mean instead of drugging down the cell of the column G down when i am putting a value in the column B or in the column E the result comes automatically in the column G.
I wouldn't mind when i was putting the date in the column F then automatically comes the result in the column G
thank you in advance
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Upvote 0
So you have converted the area into a table and can see the table design tab on the toolbar, and copied the formula to all rows initially and it still doesn't do what you want ?
 
Upvote 0
So you have converted the area into a table and can see the table design tab on the toolbar, and copied the formula to all rows initially and it still doesn't do what you want ?
yes my friend.it writes value instead of the result
 
Upvote 0
@kvemperor
I'm not sure if I understand your OP
but I supposes in G8 will contain value and from G9 will add formula . if you want just showing value not formula in column G ,then enable the line disabled as in comment inside the code
so this my try .
copy the code and paste into sheet module , not standard module
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.CountLarge > 1 Or Target.Row < 1 Then Exit Sub
Application.EnableEvents = False
If Target.Column = 2 And Target.Row > 1 Or Target.Column = 5 And Target.Row > 1 Then
lr = Range("B" & Rows.Count).End(xlUp).Row
Range("G9:G" & lr).FormulaR1C1 = "=RC[-5]+R[-1]C-RC[-2]"
'if  you  don't  show  formula in column G then enable this  line 
'Range("G9:G" & lr).Value=Range("G9:G" & lr).Value
End If
Application.EnableEvents = True
End Sub
I hope this help you.
 
Upvote 0
@kvemperor
I'm not sure if I understand your OP
but I supposes in G8 will contain value and from G9 will add formula . if you want just showing value not formula in column G ,then enable the line disabled as in comment inside the code
so this my try .
copy the code and paste into sheet module , not standard module
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.CountLarge > 1 Or Target.Row < 1 Then Exit Sub
Application.EnableEvents = False
If Target.Column = 2 And Target.Row > 1 Or Target.Column = 5 And Target.Row > 1 Then
lr = Range("B" & Rows.Count).End(xlUp).Row
Range("G9:G" & lr).FormulaR1C1 = "=RC[-5]+R[-1]C-RC[-2]"
'if  you  don't  show  formula in column G then enable this  line
'Range("G9:G" & lr).Value=Range("G9:G" & lr).Value
End If
Application.EnableEvents = True
End Sub
I hope this help you.
Thank you very much my friend for your answer. I will try it tomorrow and I will let you know
 
Upvote 0
@kvemperor
I'm not sure if I understand your OP
but I supposes in G8 will contain value and from G9 will add formula . if you want just showing value not formula in column G ,then enable the line disabled as in comment inside the code
so this my try .
copy the code and paste into sheet module , not standard module
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.CountLarge > 1 Or Target.Row < 1 Then Exit Sub
Application.EnableEvents = False
If Target.Column = 2 And Target.Row > 1 Or Target.Column = 5 And Target.Row > 1 Then
lr = Range("B" & Rows.Count).End(xlUp).Row
Range("G9:G" & lr).FormulaR1C1 = "=RC[-5]+R[-1]C-RC[-2]"
'if  you  don't  show  formula in column G then enable this  line
'Range("G9:G" & lr).Value=Range("G9:G" & lr).Value
End If
Application.EnableEvents = True
End Sub
I hope this help you.
Hallo my friend.i tried this but something is wrong and i can not do it properly.
 
Last edited by a moderator:
Upvote 0
as I said
so this my try .

here is the picture when enter values whether in column B or E start from row 9 and add value in G8 to see the changes in column G
formula.xlsm
BCDEFG
81
9762
1012113
1111113
12111-7
st
Cell Formulas
RangeFormula
G9:G12G9=B9+G8-E9
 
Last edited:
Upvote 0
as I said


here is the picture when enter values whether in column B or E start from row 9 and add value in G8 to see the changes in column G
formula.xlsm
BCDEFG
81
9762
1012113
1111113
12111-7
st
Cell Formulas
RangeFormula
G9:G12G9=B9+G8-E9
is working with column B but not with column E.this is a screenshot of my excel
 

Attachments

  • CLIENT.jpg
    CLIENT.jpg
    73.8 KB · Views: 7
Upvote 0

Forum statistics

Threads
1,215,145
Messages
6,123,289
Members
449,094
Latest member
GoToLeep

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