ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   discover format of Excel Cell using VBA (https://www.excelbanter.com/excel-programming/357874-discover-format-excel-cell-using-vba.html)

Ron Kendall

discover format of Excel Cell using VBA
 
I am trying to determine cells that contain currency amounts. Using
IsNumeric also accepts cells with text numbers such as telephone and account
numbers.

Tom Ogilvy

discover format of Excel Cell using VBA
 
this will select cells with numbers stored as currency. (if formatted as
currency, but containing no value, it will not be selected)

Sub markCurrency()
Dim rng As Range, cell As Range
For Each cell In Selection
If VarType(cell) = vbCurrency Then
If rng Is Nothing Then
Set rng = cell
Else
Set rng = Union(rng, cell)
End If
End If
Next
rng.Select
End Sub

Select a rectangular area of cells to check and run the macro.

--
Regards,
Tom Ogilvy


"Ron Kendall" wrote:

I am trying to determine cells that contain currency amounts. Using
IsNumeric also accepts cells with text numbers such as telephone and account
numbers.



All times are GMT +1. The time now is 11:59 AM.

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