Results 1 to 16 of 16

VBA coding only working in the first sheet. It is not working in all the sheets

Threaded View

  1. #1
    Forum Contributor
    Join Date
    09-14-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    239

    VBA coding only working in the first sheet. It is not working in all the sheets

    Dear Sirs,

    I am just started macror/vba coding.

    I have created a coding for displaying number in Indian currency in indian format(comma separator) in excel 2007. Though it is working in the first sheet It is not working in all the sheets. Please guide me on this.

    I would like to learn how to protect the coding. If am sending this file to others other users should not view the coding.

    code i have used as follows

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Target.Cells.Value >= 1000 And Target.Cells.Value < 10000 Then
        Target.Cells.NumberFormat = "#"",""###.00"
    ElseIf Target.Cells.Value >= 10000 And Target.Cells.Value < 100000 Then
        Target.Cells.NumberFormat = "##"",""###.00"
    ElseIf Target.Cells.Value >= 100000 And Target.Cells.Value < 1000000 Then
        Target.Cells.NumberFormat = "#"",""##"",""###.00"
    ElseIf Target.Cells.Value >= 1000000 And Target.Cells.Value < 10000000 Then
        Target.Cells.NumberFormat = "##"",""##"",""###.00"
    ElseIf Target.Cells.Value >= 10000000 And Target.Cells.Value < 100000000 Then
        Target.Cells.NumberFormat = "#"",""##"",""##"",""###.00"
    ElseIf Target.Cells.Value >= 100000000 And Target.Cells.Value < 1000000000 Then
        Target.Cells.NumberFormat = "##"",""##"",""##"",""###.00"
    ElseIf Target.Cells.Value >= 1000000000 And Target.Cells.Value < 10000000000 Then
        Target.Cells.NumberFormat = "###"",""##"",""##"",""###.00"
    End If
    End Sub
    Thanks & Regards
    N.Srinivasan
    Last edited by JBeaucaire; 09-14-2012 at 11:59 PM. Reason: Added code tags, as per forum rules. Don't forget!

Thread Information

Users Browsing this Thread

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

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