Convert/format numbers in Lakhs and Crores

rishicool786

New Member
Joined
May 12, 2017
Messages
2
Hi All,

I am a newbie with <acronym title="visual basic for applications">VBA, I have a requirement in my project
Client wants to convert numbers in cells to form of Lakhs and Crores(Indian Numbering format) with comma , sepeator after every 2 digits. How can i do this through VBA, since I have to this if User inputs Indian format then.

Hope this clears my requirement, Please let me know for any clarification.

Below I have tried,
'Event called after report refresh
Function AFTER_REFRESH()
Dim EPMObj As New FPMXLClient.EPMAddInAutomation
Dim rngData As Range
'Gets the range of the report data
Set rngData = Range(EPMObj.GetDataTopLeftCell(ActiveSheet, "000") & ":" & EPMObj.GetDataBottomRightCell(ActiveSheet, "000"))
'Calls the formatting procedure
Call procFormatCell(rngData)
End Function
'Formatting procedure
Public Sub procFormatCell(rngData As Range)
Dim rngCell
Dim LIST
Dim TEST
Dim Worksheet1
Set TEST = ActiveWorkbook.Worksheets
Set Worksheet1 = TEST("Selection")
'Selection is the name of the worksheet where the user selects the option from drop down list
LIST = Worksheet1.Cells(15, 10)
' Cells (15,10) is the cell reference where the selection is done, (row,column). Do not give a namespace to this cell
For Each rngCell In rngData
Select Case LIST
Case Is = "ABSOLUTE"
rngCell.Value = rngCell.Value
Case Is = "CRORE"
rngCell.Value = rngCell.Value / 10 ^ 7
rngCell.NumberFormat = "#,##0.00"
Case Is = "LACS"
rngCell.Value = rngCell.Value / 10 ^ 5
rngCell.NumberFormat = "#,##0.00"
Case Else
rngCell.Value = rngCell.Value
End Select
Next rngCell
End Sub

Now when I run above code, It gives error 'Type Mismatch' at this statement rngCell.Value = rngCell.Value / 10 ^ 7

Help Please.
</acronym>
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
You can use the number format #","00000 to display number in lakhs. Using that number format, 98372940 is displayed as 983,72940.
 
Upvote 0
If you want to display 99999999.99 as 999,99,999.99, use ###","##","###.00.
 
Upvote 0

Forum statistics

Threads
1,223,895
Messages
6,175,257
Members
452,625
Latest member
saadat28

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