ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How can you determine if a cell is formatted as a percent? (https://www.excelbanter.com/excel-programming/295780-how-can-you-determine-if-cell-formatted-percent.html)

quartz

How can you determine if a cell is formatted as a percent?
 
Hello, I am using VBA in Excel XP with Win 2000

I need a VBA method to determine if a cell is formatted as a percentage

Could someone please post back example code to do this?

Jan Karel Pieterse

How can you determine if a cell is formatted as a percent?
 
Hi Quartz,

I need a VBA method to determine if a cell is formatted as a percentage.


If InStr(ActiveCell.NumberFormat, "%") Then
MsgBox "Percentage"
Else
MsgBox "Other"
End If


Regards,

Jan Karel Pieterse
Excel MVP
www.jkp-ads.com


papou[_8_]

How can you determine if a cell is formatted as a percent?
 
MsgBox ActiveCell.NumberFormat = "0.00%"

HTH
Regards
Pascal

"quartz" a écrit dans le message de
news: ...
Hello, I am using VBA in Excel XP with Win 2000.

I need a VBA method to determine if a cell is formatted as a percentage.

Could someone please post back example code to do this?




quartz

How can you determine if a cell is formatted as a percent?
 
Thanks Jan! I never thought of using "InStr" like that :-



All times are GMT +1. The time now is 12:33 AM.

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