Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default code line number

I am writing a VBA a code in Excel (VB6 format). I need to
know is there any methods that I can store the" code line
number" in a variable. This will help me a lot for error
trapping.

I would appreciate your help.

Regards
Masoud

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default code line number

If you number you lines, you have the line number in erl

Sub Tester1()
On Error goto ErrHandler:
001 for i = 1 to 10
002 j = i ^ 2
003 next i
004 err.Raise 5001
005 for i = 1 to 10
006 k = i ^ 2
007 next i
008 exit sub
ErrHandler:
msgbox err.Number & " at line number " & erl
End Sub


for example.

--
Regards,
Tom Ogilvy


"Masoud" wrote in message
...
I am writing a VBA a code in Excel (VB6 format). I need to
know is there any methods that I can store the" code line
number" in a variable. This will help me a lot for error
trapping.

I would appreciate your help.

Regards
Masoud



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default code line number

Hi Tom,

Thanks for the answer. Is there any way that we can get the line number
without being obliged to add the line numbers. Our code is a legacy code with
more than 1 Million line of VBA code:)

"Tom Ogilvy" wrote:

If you number you lines, you have the line number in erl

Sub Tester1()
On Error goto ErrHandler:
001 for i = 1 to 10
002 j = i ^ 2
003 next i
004 err.Raise 5001
005 for i = 1 to 10
006 k = i ^ 2
007 next i
008 exit sub
ErrHandler:
msgbox err.Number & " at line number " & erl
End Sub


for example.

--
Regards,
Tom Ogilvy


"Masoud" wrote in message
...
I am writing a VBA a code in Excel (VB6 format). I need to
know is there any methods that I can store the" code line
number" in a variable. This will help me a lot for error
trapping.

I would appreciate your help.

Regards
Masoud




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default code line number

The ASAP Utilities add-in has a tool to automatically add or
remove line numbers. See http://www.asap-utilities.com/ for
details.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Masoud" wrote in message
...
Hi Tom,

Thanks for the answer. Is there any way that we can get the
line number
without being obliged to add the line numbers. Our code is a
legacy code with
more than 1 Million line of VBA code:)

"Tom Ogilvy" wrote:

If you number you lines, you have the line number in erl

Sub Tester1()
On Error goto ErrHandler:
001 for i = 1 to 10
002 j = i ^ 2
003 next i
004 err.Raise 5001
005 for i = 1 to 10
006 k = i ^ 2
007 next i
008 exit sub
ErrHandler:
msgbox err.Number & " at line number " & erl
End Sub


for example.

--
Regards,
Tom Ogilvy


"Masoud" wrote in message
...
I am writing a VBA a code in Excel (VB6 format). I need to
know is there any methods that I can store the" code line
number" in a variable. This will help me a lot for error
trapping.

I would appreciate your help.

Regards
Masoud






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro code to put series name next to individual line in line grap Otani Charts and Charting in Excel 3 February 23rd 10 07:24 PM
Convert a Number Code to a Text Code Traye Excel Discussion (Misc queries) 3 April 6th 07 09:54 PM
Enabling Line/Column number in code Hari[_3_] Excel Programming 4 August 18th 04 04:03 PM
Help with 1 code line Norman Jones Excel Programming 0 June 6th 04 02:08 PM
My code replace the data by the line number keawee[_4_] Excel Programming 1 November 2nd 03 02:42 PM


All times are GMT +1. The time now is 08:03 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"