• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Function assistance

ninad7

Member
I wish to write a Select Case statement in a Function, say, FormatCell(cell_reference) passing a cell value. How can this be done.


Function FormatCell(ByVal Target as Integer)

Select Case Target

Case Is <=1000

Selection.NumberFormat = "0.00"

.

.

.

and so on.....


TIA


Regards,


Ninad.
 
Ninad7


Functions are unable to change the worksheet only return a value to the cell which called them


Do you want to explain what your trying to do?


Do you know you can use Custom Number Formats to do what your trying to do

Refer:

http://chandoo.org/wp/2008/02/25/custom-cell-formatting-in-excel-few-tips-tricks/

&

http://chandoo.org/wp/2008/10/02/excel-number-formatting-tip-showing-decimals-conditionally/
 
Thanks Hui for replying. Essentially what I want to do is format in the Indian currency way (e.g. 1,00,00,000.00) by passing a cell reference value to a function and then apply the format.


The reason I wanted to go the UDF is the number could range anywhere from 1 to 1,00,00,000 Each time (based on the value), I did not want to make changes to the format.


Any simple way will be good enough.


Thanks.
 
Have you read: http://chandoo.org/wp/2010/07/26/indian-currency-format-excel/

The post describes both Custom Number formats and Operating System changes you can make to assist you.
 
Back
Top