ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA Code to identify contents of a cell (https://www.excelbanter.com/excel-programming/310958-vba-code-identify-contents-cell.html)

SLS

VBA Code to identify contents of a cell
 
Does anyone know a way to identify which cells contain values vs formulas?

RobFMS

VBA Code to identify contents of a cell
 
This will be helpful:

Tip #2: Excel Automation: More than just a formula
http://www.fmsinc.com/free/tips.html#ExcelautomationVBA

--
Rob

FMS Professional Solutions Group
http://www.fmsinc.com/consulting

Software Tools for .NET, SQL Server, Visual Basic & Access
http://www.fmsinc.com

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
"SLS" wrote in message
...
Does anyone know a way to identify which cells contain values vs formulas?




Frank Kabel

VBA Code to identify contents of a cell
 
Hi
msgbox range("A1").hasformula

--
Regards
Frank Kabel
Frankfurt, Germany

"SLS" schrieb im Newsbeitrag
...
Does anyone know a way to identify which cells contain values vs

formulas?


Norman Jones

VBA Code to identify contents of a cell
 
Hi SLS,

'\\ Use the SpecialCells method to identify all formula cells in a given
range:
On Error Resume Next
Set rng = Range("A1:D100").SpecialCells(xlFormulas)
On Error GoTo 0

'\\ Check if an individual cell contains a formula:
If Range("A1").HasFormula = True Then
'A1 contains a formula
End If

'\\ Determine if all cells in a range are formulae:
If rng.HasFormula = True Then
'all the cells in rng1 are formulae
End If


---
Regards,
Norman



"SLS" wrote in message
...
Does anyone know a way to identify which cells contain values vs formulas?





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

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