last day (15 days later) » 

4:26 PM
1
A: VBA code to remove blank cells

BruceWayneYou can't use Rows() with a column reference. Just change your first part to the rows only. If IsEmpty(Range("A827").Value) = True Then Rows("825:925").EntireRow.Delete XlDeleteShiftDirection.xlShiftUp Else Rows("827:925").EntireRow.SpecialCells(xlBlanks).EntireRow.Delete End If Or you...

 
Changed that but still not working!
 
@S.Price - How is it not working? Do you get an error? Even with the code you added in the OP, this should work. Is the code I posted working, but just giving you different outcome than you expect? The Worksheet_SelectionChange() code is in a worksheet object, right? Not a workbook module?
 
It says I run out of stack space and then gives an error on the first line (IsEmpty line)
 
@S.Price - Where is this macro saved? Is it in a Worksheet Object of the sheet you want it to run on? Are there any other macros running? If this is all the code you have, you shouldn't be getting that Stack Space error. You must have some other code running, no?
 
No other macros running and it's in the worksheet object for the xlsm file I want it to be in. The procedure seems to be set to some default selection but that shouldn't matter if the code is what it is, right?
 
4:26 PM
@S.Price - What do you mean? Where is the code being called from exactly?
@S.Price - Oh, I think I might know what's going on.
You've placed this in a Worksheet SelectionChange event. Every time you select a different cell, the code will fire.
So, if Cell A287 is blank, then it will delete rows 825:925. Therefore, any time you select a cell after this cleared the rows, it's going to clear the rows again
...and again
What I think you want/need to do, is to change when the lines delete.
because actually, even if A287 IS NOT blank, it's going to delete the rows.
Therefore, every time you select a different cell, you're deleting rows.
Possibly throwing this in to a loop
 
5:20 PM
What would be the best event to use? Is there a way that I could just make it a button that I use once everything is entered?
 
6:07 PM
@S.Price - Of course! Just change this to a regular subroutine, say Sub checkRows() and then just assign that to a button.
 
 
2 hours later…
8:37 PM
So I assigned it and it seems to execute, but it gives me a 400 error. It doesn't pinpoint it to a line either. I have a question about the code I'm using though. The cells I'm asking it to test for being empty or not don't have actually values displayed, but they are referenced to other cells in different sheets. So technically they contain something but it's just not a value. Would this cause some problems with the IsEmpty() and SpecialCells.xlBlank?
 

last day (15 days later) »