I'm trying to update a chart every time a record is inserted in the last line of Excel, so I created a variable "k", the problem is that when I run the program I get an error that I can't solve, can someone help me?
Code:
Error:
Values i need to insert:
Chart:
Chart doens´t update the last row inserted value:
Code:
VBA Code:
Public Sub Chart_Update()
Dim k As Long
k = Cells(Rows.Count, "B").End(xlUp).Row
Error at range!
--------------------------------------------------------------
Range("B2:B" & k, "E2:E" & k, "I2:I" & k, "J2:J" & k, "K2:K" & k).Select
----------------------------------------------------------------
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
Error:
Values i need to insert:
Chart:
Chart doens´t update the last row inserted value: