ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA version of ISBLANK() (https://www.excelbanter.com/excel-programming/355101-vba-version-isblank.html)

Nicholas B

VBA version of ISBLANK()
 
Anyone know how to get VBA to check if a cell is blank before reading its
formula ?

If it was just a single cell I can point to it using a formula [ Eg
=ISBLANK(D12) ] and use VBA to read the value of that Cell (the one with the
ISBLANK() Formula).

But I've many cells I want to test, cannot find a VBA equivalent to
ISBLANK() and if I use the following line

FormulaB4Change = CStr(ActiveCell.Formula)

The code crashes on empty cells

Nick


Nicholas B

VBA version of ISBLANK()
 
OK Ignore this. I'm wrong. Doesn't crash on ALL empty cells just one
particular cell
Have tried IsEmpty() but that still crashes

Thanks

"Nicholas B" wrote:

Anyone know how to get VBA to check if a cell is blank before reading its
formula ?

If it was just a single cell I can point to it using a formula [ Eg
=ISBLANK(D12) ] and use VBA to read the value of that Cell (the one with the
ISBLANK() Formula).

But I've many cells I want to test, cannot find a VBA equivalent to
ISBLANK() and if I use the following line

FormulaB4Change = CStr(ActiveCell.Formula)

The code crashes on empty cells

Nick


Jim Cone

VBA version of ISBLANK()
 
Nick,
You could also use Len(a cell reference)
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"Nicholas B"
wrote in message...
OK Ignore this. I'm wrong. Doesn't crash on ALL empty cells just one
particular cell
Have tried IsEmpty() but that still crashes

Thanks

"Nicholas B" wrote:

Anyone know how to get VBA to check if a cell is blank before reading its
formula ?

If it was just a single cell I can point to it using a formula [ Eg
=ISBLANK(D12) ] and use VBA to read the value of that Cell (the one with the
ISBLANK() Formula).

But I've many cells I want to test, cannot find a VBA equivalent to
ISBLANK() and if I use the following line

FormulaB4Change = CStr(ActiveCell.Formula)

The code crashes on empty cells

Nick



All times are GMT +1. The time now is 09:38 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com