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
 
Oops !:oops:
my bad !
I think now should work
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 = 3 And Target.Row > 1 Or Target.Column = 6 And Target.Row > 1 Then
lr = Range("C" & Rows.Count).End(xlUp).Row
lr1 = Range("F" & Rows.Count).End(xlUp).Row
Range("I9:I" & lr & ":I9:I" & lr1).FormulaR1C1 = "=RC[-6]+R[-1]C-RC[-3]"
End If
Application.EnableEvents = True
End Sub
 
Upvote 0
that's why I ask you

as I said in post#14

so can you tell me how works ? you should test again before you change the columns and show me the result .
I'm so confused:confused::confused::confused:

Oops !:oops:
my bad !
I think now should work
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 = 3 And Target.Row > 1 Or Target.Column = 6 And Target.Row > 1 Then
lr = Range("C" & Rows.Count).End(xlUp).Row
lr1 = Range("F" & Rows.Count).End(xlUp).Row
Range("I9:I" & lr & ":I9:I" & lr1).FormulaR1C1 = "=RC[-6]+R[-1]C-RC[-3]"
End If
Application.EnableEvents = True
End Sub
still value error
This is before the code
ΚΑΡΤΕΛΛΑ ΔΕΙΓΜΑ.xlsx
ABCDEFGHI
1 ONOMA
2
3
4
5
6
7ΗΜΕΡΑΑΡ.ΣΥΝΝΑΛΑΓΗΣ ΤΙΜ ΑΞΙΑ ΤΙΜ ΑΡ.ΤΙΜΑΡ.ΣΥΝΝΑΛΑΓΗΣ ENANTI ΑΞΙΑ ENANTI ΗΜΕΡΟΜΗΝΙΑ ΠΙΣΤΩΣΗ/ΕΝΑΝΤΙ ΝΕΟ ΥΠΟΛΟΙΠΟ
8 
9 
10Εκ μεταφορας2022 - €
11  500,00 € ΠΙΣΤΩΣΗ500,00 €
12 11.000,00 €ΕΝΑΝΤΙ
13 600,00 € ΠΙΣΤΩΣΗ
14 20,00 €ΕΝΑΝΤΙ
15   
16   
17   
ΕΤΑΙΡΙΑ NEO TΕΛΕΥΤΑΙΟ (3)
Cell Formulas
RangeFormula
A11:A400A11=LET(x,G11:G400,IF(x="","",WEEKDAY(x)))
I10:I11I10=C10+I9-F10
E11:E13,E15:E17E11=IF(F11="","",COUNTA($F$11:F11))
B11:B17B11=IF(D11="","",COUNTA($D$11:D11))
H8:H17H8=IF(AND(C8="",F8=""),"",IF(C8<>"",$L$2,$L$3))
Dynamic array formulas.
Cells with Conditional Formatting
CellConditionCell FormatStop If True
H8:H399Expression=H8=$L$3textNO
H8:H399Expression=H8=$L$2textNO


and this is after the code the result
ΚΑΡΤΕΛΛΑ ΔΕΙΓΜΑ.xlsx
ABCDEFGHI
1 ONOMA
2
3
4
5
6
7ΗΜΕΡΑΑΡ.ΣΥΝΝΑΛΑΓΗΣ ΤΙΜ ΑΞΙΑ ΤΙΜ ΑΡ.ΤΙΜΑΡ.ΣΥΝΝΑΛΑΓΗΣ ENANTI ΑΞΙΑ ENANTI ΗΜΕΡΟΜΗΝΙΑ ΠΙΣΤΩΣΗ/ΕΝΑΝΤΙ #ΤΙΜΗ!
8 #ΤΙΜΗ!
9 #ΤΙΜΗ!
10Εκ μεταφορας2022 #ΤΙΜΗ!
11  500,00 € ΠΙΣΤΩΣΗ#ΤΙΜΗ!
12 11.000,00 €ΕΝΑΝΤΙ#ΤΙΜΗ!
13 600,00 € ΠΙΣΤΩΣΗ#ΤΙΜΗ!
14 20,00 €ΕΝΑΝΤΙ#ΤΙΜΗ!
15   
16   
17   
18   
ΕΤΑΙΡΙΑ NEO TΕΛΕΥΤΑΙΟ (3)
Cell Formulas
RangeFormula
A11:A400A11=LET(x,G11:G400,IF(x="","",WEEKDAY(x)))
E11:E13,E15:E18E11=IF(F11="","",COUNTA($F$11:F11))
I7:I14I7=C7+I6-F7
B11:B18B11=IF(D11="","",COUNTA($D$11:D11))
H8:H18H8=IF(AND(C8="",F8=""),"",IF(C8<>"",$L$2,$L$3))
Dynamic array formulas.
Cells with Conditional Formatting
CellConditionCell FormatStop If True
H8:H399Expression=H8=$L$3textNO
H8:H399Expression=H8=$L$2textNO


somehow it gives value error and from the beginning of the column I
 
Upvote 0
are you sure ?
this is what I got for your data
Microsoft Excel.xlsx
ABCDEFGHI
7ΗΜΕΡΑΑΡ.ΣΥΝΝΑΛΑΓΗΣ ΤΙΜ ΑΞΙΑ ΤΙΜ ΑΡ.ΤΙΜΑΡ.ΣΥΝΝΑΛΑΓΗΣ ENANTI ΑΞΙΑ ENANTI ΗΜΕΡΟΜΗΝΙΑ ΠΙΣΤΩΣΗ/ΕΝΑΝΤΙ
8 11
9112200
10123Εκ μεταφορας1220220111
1
Cell Formulas
RangeFormula
H8:H10H8=IF(AND(C8="",F8=""),"",IF(C8<>"",$L$2,$L$3))
I9:I10I9=C9+I8-F9

can you attach your file by dropbox to see what's the problem ?
 
Upvote 0

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
are you sure ?
this is what I got for your data
Microsoft Excel.xlsx
ABCDEFGHI
7ΗΜΕΡΑΑΡ.ΣΥΝΝΑΛΑΓΗΣ ΤΙΜ ΑΞΙΑ ΤΙΜ ΑΡ.ΤΙΜΑΡ.ΣΥΝΝΑΛΑΓΗΣ ENANTI ΑΞΙΑ ENANTI ΗΜΕΡΟΜΗΝΙΑ ΠΙΣΤΩΣΗ/ΕΝΑΝΤΙ
8 11
9112200
10123Εκ μεταφορας1220220111
1
Cell Formulas
RangeFormula
H8:H10H8=IF(AND(C8="",F8=""),"",IF(C8<>"",$L$2,$L$3))
I9:I10I9=C9+I8-F9

can you attach your file by dropbox to see what's the problem ?
this is the link.i believe i made it properly.
 
Upvote 0
cancel merging the columns and try this

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.CountLarge > 1 Or Target.Row < 8 Then Exit Sub
Application.EnableEvents = False
If Target.Column = 3 And Target.Row > 8 Or Target.Column = 6 And Target.Row > 8Then
lr = Range("C" & Rows.Count).End(xlUp).Row
lr1 = Range("F" & Rows.Count).End(xlUp).Row
Range("I9:I" & lr & ":I9:I" & lr1).FormulaR1C1 = "=RC[-6]+R[-1]C-RC[-3]"
End If
Application.EnableEvents = True
End Sub
if it's doesn't work for you should wait else body . sorry !
 
Last edited:
Upvote 0
cancel merging the columns and try this

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.CountLarge > 1 Or Target.Row < 8 Then Exit Sub
Application.EnableEvents = False
If Target.Column = 3 And Target.Row > 7 Or Target.Column = 6 And Target.Row > 7 Then
lr = Range("C" & Rows.Count).End(xlUp).Row
lr1 = Range("F" & Rows.Count).End(xlUp).Row
Range("I9:I" & lr & ":I9:I" & lr1).FormulaR1C1 = "=RC[-6]+R[-1]C-RC[-3]"
End If
Application.EnableEvents = True
End Sub
if it's doesn't work for you should wait else body . sorry !
it doesn t work either. But i must thank you for all your effort. If anyone else doesn t succeed to make it then i will try also in other forums.if i find the solution i will post it also here(with the link of the other forum of course)for educational reasons.
Anyway thank you again for all your effort
 
Upvote 0
Hi
try this
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)

If Target.CountLarge > 1 Or Target.Row < 8 Then Exit Sub
Application.EnableEvents = False
If Target.Column = 3 And Target.Row > 8 Or Target.Column = 6 And Target.Row > 8 Then
Dim LR1 As Integer
LR1 = Range("F" & Rows.Count).End(xlUp).Row
For i = 9 To LR1
Range("I9:I" & i).FormulaR1C1 = "=RC[-6]+R[-1]C-RC[-3]"
Next
End If
Application.EnableEvents = True
End Sub
 
Upvote 0
Hi
try this
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)

If Target.CountLarge > 1 Or Target.Row < 8 Then Exit Sub
Application.EnableEvents = False
If Target.Column = 3 And Target.Row > 8 Or Target.Column = 6 And Target.Row > 8 Then
Dim LR1 As Integer
LR1 = Range("F" & Rows.Count).End(xlUp).Row
For i = 9 To LR1
Range("I9:I" & i).FormulaR1C1 = "=RC[-6]+R[-1]C-RC[-3]"
Next
End If
Application.EnableEvents = True
End Sub
Hallo my friend again. I will try this one tomorrow and I let you know. I hope this time will work 😕
 
Upvote 0

Forum statistics

Threads
1,215,824
Messages
6,127,109
Members
449,359
Latest member
michael2

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