ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   strange vba break (https://www.excelbanter.com/excel-programming/429612-re-strange-vba-break.html)

greg

strange vba break
 

So this is basically the code. I bit chunked out.
it stops on the the iMainLoop line. So strange.

I have break on unhandled errors.
thanks

----------------------------------
Sub LoadJoinedTable()
On Error GoTo PlannerError

Dim JoinedTable As Range
Dim iMainLoop As Integer

Dim objWS As Worksheet
Set objWS = Worksheets(WKSHT_JOINED_TABLE)

Set JoinedTable = objWS.Range(RANGE_JT_JOINED_TABLE)
objWS.Range(RANGE_JT_JOINED_TABLE).Worksheet.Activ ate

For iMainLoop = 1 To JoinedTable.Rows.Count
-------------------------------------


"Don Guillett" wrote in message
...
As always, post your code for comments and suggestions.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"greg" wrote in message
...
I have a very strange scenario.
I am developing a xla for excel.
The first time I open up excel and run the xla, it breaks on one specific
line.
I can press run and it goes to the end.
The next time (and every other time) I run the xla, it does not stop.
There is no breakpoint on that line.
I have even rebooted. open excel. and run the xla. and it stops in the
same place.
The sub has an on error goto, so it is not the break on unhandled errors.
But it also only stops the first time opening excel. so I don't think
this is the reason.

Anyone have any ideas on how to stop this from happening?
thanks






Tim Williams[_2_]

strange vba break
 
What happens if you remove the error handler?

You might try fully qualifying all of your sheet references by including the
workbook

Eg:
Set objWS = ThisWorkbook.Worksheets(WKSHT_JOINED_TABLE)
instead of
Set objWS = Worksheets(WKSHT_JOINED_TABLE)

With multiple workbooks open the results using unqualified references can
sometimes be unpredictable.

Tim

"greg" wrote in message
...

So this is basically the code. I bit chunked out.
it stops on the the iMainLoop line. So strange.

I have break on unhandled errors.
thanks

----------------------------------
Sub LoadJoinedTable()
On Error GoTo PlannerError

Dim JoinedTable As Range
Dim iMainLoop As Integer

Dim objWS As Worksheet
Set objWS = Worksheets(WKSHT_JOINED_TABLE)

Set JoinedTable = objWS.Range(RANGE_JT_JOINED_TABLE)
objWS.Range(RANGE_JT_JOINED_TABLE).Worksheet.Activ ate

For iMainLoop = 1 To JoinedTable.Rows.Count
-------------------------------------


"Don Guillett" wrote in message
...
As always, post your code for comments and suggestions.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"greg" wrote in message
...
I have a very strange scenario.
I am developing a xla for excel.
The first time I open up excel and run the xla, it breaks on one
specific line.
I can press run and it goes to the end.
The next time (and every other time) I run the xla, it does not stop.
There is no breakpoint on that line.
I have even rebooted. open excel. and run the xla. and it stops in
the same place.
The sub has an on error goto, so it is not the break on unhandled
errors. But it also only stops the first time opening excel. so I don't
think this is the reason.

Anyone have any ideas on how to stop this from happening?
thanks









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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com