Linea Error

mario231179

New Member
Joined
Feb 6, 2008
Messages
8
Buenos Dias, necesitaria saber si se puede conocer el numero de linea donde se produce un error en el codigo VB de excel, ya que tengo una rutina con un ON ERROR GO XXXX:, en ella muestro un msgbox en pantalla con la descripcion del error producido, pero al ser extenso el codigo no se que linea lo produjo.

Muchas Gracias
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Realmente No sé si existe manera de capturar eso....
Yo pruebo mi codigo con F8 paso a Paso, pero en tiempo de ejecucion pueden producirse errrores, que no se perciban en el Paso a paso....

lo unico que se me ocurre es intercalar la siguiente sentencia
antes de cada linea de codigo

i = i + 1

y en el MsgBox hacer aparecer el i
 
Upvote 0
Si se puede... toca hacer algo así:

Code:
Option Explicit

Sub Test()
    Dim a As Long
    Dim b As Long

On Error GoTo catch:
1   a = 1
2   b = 0
    
3   MsgBox a / b
4   Exit Sub
catch:
    MsgBox "Error en la línea: " & Erl
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,958
Messages
6,175,636
Members
452,662
Latest member
Aman1997

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top