• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 33. Debugging Macros and Custom ... > Dealing with Run-Time Errors

Dealing with Run-Time Errors

In many cases, run-time errors are caused by factors outside your control. For example, suppose you have written the following macro to format the numbers in a selected range using the Indian system of lakhs and crores:

Sub LakhsCrores()
    Dim cell as Object
    For Each cell In Selection
        If Abs(cell.Value) > 10000000 Then
            cell.NumberFormat = "#"",""##"",""##"",""###"
        ElseIf Abs(cell.Value) > 100000 Then
            cell.NumberFormat = "##"",""##"",""###"
        End If
    Next cell
End Sub


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint