vba help - Number format for blank cell want dash

Mallesh23

Well-known Member
Joined
Feb 4, 2009
Messages
976
Office Version
  1. 2010
Platform
  1. Windows
Hi Team,

Need your help in applying format, if there are blank add dash.

Below attempted code which only covers positive and negative nos. not blank cells

VBA Code:
Sub test()
Range("A2:A6").NumberFormat = "#,#.00"
End Sub

Below is a table with expected output in Column C.

Book10
ABC
1Raw DataExpected
250005,000.00
3100100.00
4-4000-4,000.00
5-
61800018,000.00
Sheet1



Thanks
mg
 
Hi Rory,

Great ! Thanks for your help, it is working now. ?


Thanks
mg
 
Upvote 0

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Hi Rory,

Custom Format. shows below formating..
_ * #,##0.00_ ;_ * -#,##0.00_ ;_ * "-"??_ ;_ @_

Thanks
mg
I tried it and it did nothing for blank cells. For cells containing zero, a dash was displayed. Am I missing something?
 
Upvote 0
Hi Yku,

I was looking a dash for 0 zero values.
Can we also show dash for blank cells as well.


Thanks
mg
 
Upvote 0
No, not with a number format, as I said earlier.
 
Upvote 0
Hi Rory,

Thanks once again for the information. (y)


Thanks
mg
 
Upvote 0

Forum statistics

Threads
1,214,415
Messages
6,119,377
Members
448,888
Latest member
Arle8907

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