it is glitching sorry

If Not IsEmpty(Worksheets(SheetContainingtheCells).Range( "G" & lngRows)) Then

says that is a subscript out of range and highlights the above line