Dear Excel Experts
Trying to solve problem with macro. However, my VBA coding skills are basic. Any help or hint is welcome
Here is code written correctly(code is not written by me)
What I need exactly? Lets say we limit/cant exceed rows in column to 48 (make range from A2 to A49) and IF any value reaches A49 then A2 delete any value, A49 is filled with new value and whole A2:A48 row moves up. It is cycle.
Something like code below :
I do not know how to combine those two codes. If you have any question just ask
Thanks for your willingness to help others
Have a nice day
Trying to solve problem with macro. However, my VBA coding skills are basic. Any help or hint is welcome
Here is code written correctly(code is not written by me)
Code:
Private Sub Worksheet_Calculate()'Check if values haven't changed
If Range("F13").Value = Cells(Rows.Count, 1).End(xlUp).Value And _
Range("K13").Value = Cells(Rows.Count, 2).End(xlUp).Value Then Exit Sub
'Store the new values
Application.EnableEvents = False
If Range("F13").Value <> Cells(Rows.Count, 1).End(xlUp).Value And _
Range("F13").Value > 0 Then
Cells(Rows.Count, 1).End(xlUp)(2).Value = Range("F13").Value
End If
If Range("K13").Value <> Cells(Rows.Count, 2).End(xlUp).Value And _
Range("K13").Value > 0 Then
Cells(Rows.Count, 2).End(xlUp)(2).Value = Range("K13").Value
End If
Application.EnableEvents = True
End Sub
What I need exactly? Lets say we limit/cant exceed rows in column to 48 (make range from A2 to A49) and IF any value reaches A49 then A2 delete any value, A49 is filled with new value and whole A2:A48 row moves up. It is cycle.
Something like code below :
Code:
Dim NR As Long NR = Range("A" & Cells(Rows.Count).Row).End(xlUp).Row + 1
Range("A" & NR).Value = Range("F13").Value
If NR > 48 Then
Range("A2:A48").Value = Range("A3:A49").Value
Range("A49").ClearContents
End If
I do not know how to combine those two codes. If you have any question just ask
Thanks for your willingness to help others
Have a nice day
