![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: May 2002
Posts: 31
|
Is there a way to tell the macro to show me where the code stops when the error occurs - such as a marker or curser that is placed in the position in the code at the point the macro errors out? That would be a great help.
I remember from my old MS Basic programming days (early '80s) that when the program errored, the error read "subscript out of range error in line 30". then you know exactly, "Oh, it's that array that caused the problem!" Oh, for the good 'ol days. |
|
|
|
|
|
#2 |
|
MrExcel MVP, Administrator
Join Date: Feb 2002
Location: The act or process of locating.
Posts: 13,679
|
If you "step into" the macro by using F8, when it hits an error it will highlight the offending line in yellow (at least for me, it does).
|
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Feb 2002
Posts: 3,064
|
Hi Kristy - first you dead on (correct)
debug / compile will allow a check also, and there are VBA utility’s out there, mix results from what im told I would always say post he code and some guru lurk on this board, they will soon have you in check post the code we will look it over
__________________
Free Excel based Web Toolbar available here. Jack in the UK J & R Excel Solutions "making Excel work for you" |
|
|
|
|
|
#4 |
|
Board Regular
Join Date: Feb 2002
Posts: 3,064
|
__________________
Free Excel based Web Toolbar available here. Jack in the UK J & R Excel Solutions "making Excel work for you" |
|
|
|
|
|
#5 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Columbus, OH, USA
Posts: 3,519
|
Jack
I was reading this thread and I wondered where all the other posts went. |
|
|
|
|
|
#6 |
|
New Member
Join Date: May 2002
Posts: 31
|
Kristy -
Yes, you were Dead on!!! The stepping F8 indicated that the error occurs when I try to execute the following command: For shtcnt = sheets.Count To 1 Step -1 ' cycles through worksheets from back to front sheets(shtcnt).Activate 'activates current worksheet in the workbook. THIS IS THE LINE THAT ERRORS OUT!!! If sheets(shtcnt).Visible = False Then GoTo 25 If Sheets(shtcnt) is an array, then do I need to dimension it, and if so, how? My watch window tells me that the value of shtcnt is never below 1. |
|
|
|
|
|
#7 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Columbus, OH, USA
Posts: 3,519
|
Quote:
|
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|