ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Determining whether selected cell has value or formula? (https://www.excelbanter.com/excel-programming/273091-determining-whether-selected-cell-has-value-formula.html)

John Wirt

Determining whether selected cell has value or formula?
 
I have a simple question. in VBA, how can one determine whether the
currently selected cell has a value or a formla in it?

John Wirt



Chip Pearson

Determining whether selected cell has value or formula?
 
John,

Use the HasFormula property. E.g.,

If Range("A1").HasFormula = True Then
' cell has formula
Else
' cell doesn't have formula
End If


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"John Wirt" wrote in message
...
I have a simple question. in VBA, how can one determine whether

the
currently selected cell has a value or a formla in it?

John Wirt





John Wirt[_2_]

Determining whether selected cell has value or formula?
 
Thank you, Chip. I will note this one for the future.

John

"Chip Pearson" wrote in message
...
John,

Use the HasFormula property. E.g.,

If Range("A1").HasFormula = True Then
' cell has formula
Else
' cell doesn't have formula
End If


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"John Wirt" wrote in message
...
I have a simple question. in VBA, how can one determine whether

the
currently selected cell has a value or a formla in it?

John Wirt







John Wirt[_2_]

Determining whether selected cell has value or formula?
 
If I include this before the statement where I want to obtain the formula in
a cell, I will be able to only select when the cell contains a formula. The
program will be better.

John

"Chip Pearson" wrote in message
...
John,

Use the HasFormula property. E.g.,

If Range("A1").HasFormula = True Then
' cell has formula
Else
' cell doesn't have formula
End If


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"John Wirt" wrote in message
...
I have a simple question. in VBA, how can one determine whether

the
currently selected cell has a value or a formla in it?

John Wirt








All times are GMT +1. The time now is 01:57 AM.

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