Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
capture cell number format with VBA
for example cell number format may be: "0.0%"
Can i detect the format with code? I have a sheet with various cell formats with Before double click I want to convert the number in the cell to a string containing the number with a text "symbol" added to the end of that string Then return the number to it's original format with Round(), etc. My code is working OK but, for example, i am getting 0.2333445 instead of 23% Thanks |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
capture cell number format with VBA
david,
Like this r = ActiveCell.NumberFormat With regard to 0.2333445 that is 23% well nearly, it's a little bit over mike "David" wrote: for example cell number format may be: "0.0%" Can i detect the format with code? I have a sheet with various cell formats with Before double click I want to convert the number in the cell to a string containing the number with a text "symbol" added to the end of that string Then return the number to it's original format with Round(), etc. My code is working OK but, for example, i am getting 0.2333445 instead of 23% Thanks |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
capture cell number format with VBA
Perhaps you mean this myval = 0.2333445 p = Format(myval, ActiveCell.NumberFormat) Debug.Print p Mike "Mike H" wrote: david, Like this r = ActiveCell.NumberFormat With regard to 0.2333445 that is 23% well nearly, it's a little bit over mike "David" wrote: for example cell number format may be: "0.0%" Can i detect the format with code? I have a sheet with various cell formats with Before double click I want to convert the number in the cell to a string containing the number with a text "symbol" added to the end of that string Then return the number to it's original format with Round(), etc. My code is working OK but, for example, i am getting 0.2333445 instead of 23% Thanks |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
capture cell number format with VBA
Thanks Mike
This was what i was looking for... i typed Range("A1"). and scrolled down the longggg list i was blindsighted looking for .format or similar so, in the end this turns out to be an attitude problem ah well, learning from experience thanks again "Mike H" wrote: david, Like this r = ActiveCell.NumberFormat With regard to 0.2333445 that is 23% well nearly, it's a little bit over mike "David" wrote: for example cell number format may be: "0.0%" Can i detect the format with code? I have a sheet with various cell formats with Before double click I want to convert the number in the cell to a string containing the number with a text "symbol" added to the end of that string Then return the number to it's original format with Round(), etc. My code is working OK but, for example, i am getting 0.2333445 instead of 23% Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Capture conditional format as cell format | Excel Discussion (Misc queries) | |||
Capture a number from a cell containing numbers and letters | Excel Programming | |||
Capture Col number | Excel Programming | |||
Number format based on number format of another cell in another workbook | Excel Programming | |||
How to capture row number | Excel Programming |