Good Day
I'm having a problem with one of my subs. The code I'm using, is identical to code that I have in several common subs, (that are slightly different but the same idea) in my program; and they work fine. I can't figure out why it doesn't work. In the REM statements, of the code that I included below, I've identified the area of concern. I'm still a bit green and learning as I go.. I would really appreciate your help...Thanks in advance ...Here is the code:
Purpose: I add rows to my table daily and want to delete from 600 rows from the end up to row 15. This in turn populates a chart.
Code
Sub RngDelME()
Dim RngA
Dim FirstCell
Dim LastCell
Sheets("Meals Data").Select
Call Column4_FirstBlank
'Selects the last cell with data in Column D
RngA = ActiveCell.Row
'and assigns the row value to variable RngA
If RngA > 615 Then
Set FirstCell = RngA.Offset(-600, -3)
'It calculates the RngA>615 but when it gets to the Set FirstCell that is when it quits
'Should Set Variable called FirstCell to the 600th row back & 3 columns back
'from the end (First to be deleted)
'***I get the error message OBJECT REQUIRED
End If
Set LastCell = Range("V15")
'Sets variable called LastCell to the 15th row
Range(FirstCell, LastCell).Delete Shift:=xlUp
'Keeps the last 150 rows then deletes to row 10 of data (actual row 15)
End Sub
Display More
Very much appreciated...Jimmy