I created a code so that each time a record was inserted into a line the program would detect the last line with values (assigned to the variable "k") and select a specific interval for the graph to update, but an error occurs, could someone help me ?
VBA Code:
Public Sub Chart_Update()
Dim k As Long
k = Cells(Rows.Count, "B").End(xlUp).Row
Range ("B2:B" & k & ",E2:E" & k & ",I2:K" & k & ",J2:J" & k & "K2:K & k")
'Error there!!
----------------------
ActiveChart.SetSourceData Source:=Range( _
"AC_Offset_Registers!"$B$2:$B$" & k ,AC_Offset_Registers!"$E$2:$E$" & k ,AC_Offset_Registers!"$I$2:$I$" & k ,AC_Offset_Registers!"$J$2:$J$" & k,AC_Offset_Registers!"$K$2:$K$" & k" _
)
-----------------
End Sub
I know the variable "k" is in a comment but I don't know where I should put the quotes so the syntax is correct