+ Reply to Thread
Results 1 to 6 of 6

Adding Indian Rupee Symbol to an existing VBA code.

  1. #1
    Registered User
    Join Date
    03-15-2025
    Location
    California
    MS-Off Ver
    Office 2013 Professional
    Posts
    4

    Adding Indian Rupee Symbol to an existing VBA code.

    I have the following code from member shg.

    Sub ApplyLakh()
    FondOLakh Selection
    End Sub

    Sub FondOLakh(r As Range)
    ' shg 2009-0607
    ' Applies Lakh/Crore formatting to numeric cells in r
    ' One 1
    ' Ten 10
    ' Hundred 100
    ' Thousand 1,000
    ' Lakh 1,00,000
    ' Crore 1,00,00,000
    ' Thousand Crore 1,000,00,00,000
    ' Lakh Crore 1,00,000,00,00,000

    Const dEps As Double = 0.001
    Const LN10 As Double = 2.30258509299405

    Static vFmt As Variant

    Dim cell As Range
    Dim i As Long
    Dim dLog As Double

    If IsEmpty(vFmt) Then
    vFmt = Array( _
    "0.00_);(0.00)", _
    "00.00_);(00.00)", _
    "000.00_);(000.00)", _
    "0\,000.00_);(0\,000.00)", _
    "00\,000.00_);(00\,000.00)", _
    "0\,00\,000.00_);(0\,00\,000.00)", _
    "00\,00\,000.00_);(00\,00\,000.00)", _
    "0\,00\,00\,000.00_);(0\,00\,00\,000.00)", _
    "00\,00\,00\,000.00_);(00\,00\,00\,000.00)", _
    "000\,00\,00\,000.00_);(000\,00\,00\,000.00)", _
    "0\,000\,00\,00\,000.00_);(0\,000\,00\,00\,000.00)", _
    "00\,000\,00\,00\,000.00_);(00\,000\,00\,00\,000.00)", _
    "#0\,00\,000\,00\,00\,000.00_);(#0\,00\,000\,00\,00\,000.00)")
    End If

    Application.EnableEvents = False

    For Each cell In Intersect(r, r.Parent.UsedRange)
    If IsNumeric(cell.Value) Then
    If cell.Value = 0# Then
    cell.NumberFormat = "-??_)"
    Else
    i = Int(Log(Abs(cell.Value + dEps)) / LN10)
    If i < 0 Then i = 0
    If i > UBound(vFmt) Then i = UBound(vFmt)
    cell.NumberFormat = vFmt(i)
    End If
    End If
    Next cell

    Application.EnableEvents = True
    End Sub
    This macro works perfectly and shows negative numbers in parentheses. How do I add an Indian rupee symbol to this code so that each item will appear with the rupee symbol?
    Last edited by CosmicOne; 03-25-2025 at 06:45 PM. Reason: To add "Solved" to the title

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    49,005

    Re: Adding Indian Rupee Symbol to an existing VBA code.

    Try this:

    Please Login or Register  to view this content.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    03-15-2025
    Location
    California
    MS-Off Ver
    Office 2013 Professional
    Posts
    4

    Re: Adding Indian Rupee Symbol to an existing VBA code.

    It worked for positive numbers but no rupee symbol before negative numbers in parentheses. Thank you so much.
    Last edited by CosmicOne; 03-16-2025 at 10:14 PM.

  4. #4
    Forum Contributor
    Join Date
    01-25-2025
    Location
    Presov, Slovakia
    MS-Off Ver
    2021
    Posts
    287

    Re: Adding Indian Rupee Symbol to an existing VBA code.

    Hi,
    another version - also for negative numbers
    m.s.


    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    03-15-2025
    Location
    California
    MS-Off Ver
    Office 2013 Professional
    Posts
    4

    Re: Adding Indian Rupee Symbol to an existing VBA code.

    That worked beautifully! Thank you so much.

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    49,005

    Re: Adding Indian Rupee Symbol to an existing VBA code.

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, you may not be aware that you can thank those who have helped you by clicking the small star icon (Next to Add Reputation) located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. add rupee symbol in formula
    By sanjuss2 in forum Excel General
    Replies: 5
    Last Post: 03-30-2019, 03:33 AM
  2. [SOLVED] How to insert ₹ (Rupee symbol)
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-18-2015, 08:12 AM
  3. Indian Rupee format for figure already entered in excel
    By srinivasan1965 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-04-2015, 02:45 AM
  4. MS Excel Rupee Symbol Not Displaying as a different symbol
    By perpectuals in forum Excel General
    Replies: 1
    Last Post: 07-02-2015, 07:03 AM
  5. Replies: 2
    Last Post: 03-17-2011, 08:55 PM
  6. Currency symbol -Rupee
    By ran1 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-25-2010, 10:12 AM
  7. Comma separator for custom Currency (Indian Rupee)
    By Bald Eagle in forum Excel General
    Replies: 1
    Last Post: 01-15-2006, 02:50 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1