ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Determinging the Format of a cell (https://www.excelbanter.com/excel-programming/278332-determinging-format-cell.html)

Ric Payne

Determinging the Format of a cell
 
Is there a way to determine whether a cell has been formatted as a PCT%?
Thanks in advance for your help with this.

Alan

Determinging the Format of a cell
 
"Ric Payne" wrote in message
om...

Is there a way to determine whether a cell has been formatted as a
PCT%? Thanks in advance for your help with this.


Hi Ric,

Try the CELL function:

=IF(CELL("format",A1)="P0","Percent_0","Other")

HTH,

Alan.




Robin Hammond

Determinging the Format of a cell
 
Ric,

Alternatively, you can do it without needing to know all the names of the
formats that might be applied, which is probably more flexible. This picks
up any format ending iwth a percentage.

Function IsPercentFormat(rngCell as range) as boolean
Dim strFormat as String
'note no error traps for multiple cell range
strFormat= rngCell.NumberFormat
If (InStr(1, strFormat, "%", 1)) 1 Then IsPercentFormat=True
End Function

--
Robin Hammond
www.enhanceddatasystems.com
Check out our XspandXL add-in


"Ric Payne" wrote in message
om...
Is there a way to determine whether a cell has been formatted as a PCT%?
Thanks in advance for your help with this.





All times are GMT +1. The time now is 12:19 PM.

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