Reading Values in a particular Format

NimishK

Well-known Member
Joined
Sep 4, 2015
Messages
684
Hello


I ve used the following and getting the figure as _(5036882.00)
Code:
Textbox4.text = Format(Ws.Cells(3, 10).value, "_(*#,##0.00_);_(*#,##0.00);_(* ""-""??_);_(@_)")
How the same can be read as 50,36,882 or 50,36,882.00
if i remove the underscore from above syntax still reads as 5,036,882

thanks
NimishK
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Hi,

try

Code:
Textbox4.Text = Ws.Cells(3, 10).Text


This should display what you see in the cell in your chosen format.

Dave
 
Upvote 0
Dave

Thanks.
But if i had to put the same from Textbox to a Cell .what would it be like. How would i have given the newformat in textbox and with appropriate syntax ?
 
Upvote 0
Dave

Thanks.
But if i had to put the same from Textbox to a Cell .what would it be like. How would i have given the newformat in textbox and with appropriate syntax ?

Solution assumed that your Range is already formatted in required manner.

You can specify formatting to a range in your code by using the Range.NumberFormat property

untested example

Code:
  With Ws.Cells(3, 1)
        .Value = Me.TextBox4.Value
        .NumberFormat = "_(*#,##0.00_);_(*#,##0.00);_(* ""-""??_);_(@_)"
    End With


Dave
 
Upvote 0
Thanks Dave for your help
and Rick your mini blog was an excellent refernce.
Doubts cleared.
Thanks Guys (y)
 
Upvote 0
Got an issue for getting negative values ie. why posting on the same thread

How can i get the below syntax in Brackets ie the if the value in cell becomes negative
Code:
ws.Cells(3, 1).NumberFormat = Trim(Replace(Format(String(Len(Int(ws.Cells(3, 1))) - 1, "#"), " @@\\,@@\\,@@\\,@@\\,@@\\,@@\\,@@0"), " \,", "")) & ".00"
ws.Cells(3, 1).NumberFormat = "General;(General)"
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,904
Messages
6,122,169
Members
449,070
Latest member
webster33

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top