The feature is in vb.net which I like. Is there a reason why you need the numbers?
You can copy and paste to a sheet if you need a quick view of them.
Option Compare Text
Private Sub AddLineNumbers_Click()
Set sh = Sheet4
ctr = 0
For i = 7 To 1000
If sh.Cells(i, 1) = "" Then GoTo Next_i ' find start of code
If sh.Cells(i, 1) = "End Sub" Then Exit For
If sh.Cells(i, 1) = "End Function" Then Exit For
ctr = ctr + 1
fi = Format(ctr, "000")
sh.Cells(i, 1) = fi & " " & sh.Cells(i, 1)
Next_i:
Next i
sh.Cells(7, 1).Activate
End Sub
Private Sub RemoveLineNumbers_Click()
'cooment
Set sh = Sheet4
For i = 7 To 1000
If sh.Cells(i, 1) = "" Then GoTo Next_i ' find start of code
If sh.Cells(i, 1) = "End Sub" Then Exit For
If sh.Cells(i, 1) = "End Function" Then Exit For
sh.Cells(i, 1) = Mid(sh.Cells(i, 1), 5)
Next_i:
Next i
sh.Cells(7, 1).Activate
End Sub
Sub test()
1 On Error Resume Next
2 i = 1 / 0
3 MsgBox "Hi, I am line: " & Erl
End Sub
Hello mikerickson,
What references should be enabled in order for this to work? While running it tells me that vbext_pk_Proc is not defined. If I remove the Option Exsplicit then Excel tells me: ByRef argument type mismatch and points back to vbext_pk_Proc. How should vbext_pk_Proc be decalre what type of variable is it, string?
Thanks.