excel computer course london - on error statements
Microsoft Office Training verified by visa - mastercard securecode about microsoft training company london ukadd this page to your favourites/bookmarksAdd to favourites
view a printable version of this pagePrintable version
email this page to somebodyEmail this page
Customer: Sign in
Delegate: Sign in
Trainer: Log in

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and Help » excel computer course london - On error statements

excel computer course london - On error statements

The UK's most regular instructor-led training courses.
Training information: excel computer course london · Microsoft excel training · VBA training in London

resolvedResolved · Low Priority · Version Standard

On error statements

Samantha has attended:
Excel VBA course

by - delegate Samantha [21 posts] (2007 Nov 22 Thu, 12:23) replyReply

I have a For Next loop where i am searching for a variable within the loop.
I have an ON ERROR statement before the loop to say goto a stamp which says "Next" so that if the program cant find the variable, it will just do the next one.

The loop occurs three times, first with no error, second with an error and then third with an error again. And on the third error i get an "Error 91 Object variable..." error message.

I dont understand why when it gets to the second time the error occurs, it will not go to the error stamp to go Next again.

Code below:
On Error GoTo nextagent

For a = 6 To grandtotal1 - 1
'start with first agent and assign agent name
Range("A" & a).Select
agentname = ActiveCell.Value

Range("G5:J" & grandtotal2 - 1).Select
Selection.Find(What:=agentname, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
'set a variable which sets the agent found row
agentfound = ActiveCell.Row

'log the low month position
Range("E" & a).Select

'now get low position by taking the activerow and minusing 5 rows (top header rows)
positionlow = agentfound - 5
ActiveCell.Value = positionlow

'now put the increase/decrease % into column F
Range("F" & a).Select
ActiveCell.FormulaR1C1 = "=SUM(R[" & agentfound - a & "]C[4]/RC[-2])-1"
Selection.NumberFormat = "0.00%"


nextagent:
Next

Can anyone help?

Excel Intermediate 1 day course
Version Date Location Places
available
Book Next place rate:
Card Invoice
2003 2008 Dec 4 Thu Bayswater 3 book now £195 £205
2007 2008 Dec 8 Mon Bayswater 3 book now £224 £224
2007 2008 Dec 9 Tue Bloomsbury 0 FULL    
2002/XP 2008 Dec 9 Tue Tooting 0 FULL    
2003 2008 Dec 11 Thu Southwark 7 book now £188 £215
2007 2008 Dec 16 Tue Bayswater 6 book now £207 £215
Full Schedule: See all 109 Excel Intermediate course dates.
Bookings currently available until 25th November 2009.

RE: On error statements

by - delegate Samantha [21 posts] (2007 Nov 22 Thu, 13:01) replyReply

i have figured this out.
have put in an on error resume next at top
then set an if statement to say

if err.number <> 0 then
goto nextagent
end if

then at nextagent label included
err.clear

which then cleared the error.


Related articles

· Fun Things I've Done With Excel
· Tips to Facilitate Printing of Excel worksheets
· Tap the Power of Recorded Macros with MS Excel Courses
· 5 Microsoft Excel Charts for Creating Stunning Business Documents
· Microsoft Excel Features and Functions for Accountants

Excel tip:

Apply currency format quickly in Excel

To quickly apply the currency format to cell in your spreadsheet, select (highlight) the cells you wish to apply currency format to, then use Ctrl + Shift + $

This will apply a pounds symbol even though the $ key is pressed.

View all Excel hints and tips

Rate this page:
4.0/5 (3 votes cast)
Institute of IT Training - Accredited Training Provider Microsoft Certified Partner
microsoft office
Microsoft Office Specialist Authorised Testing Centre (MOS and MCAS)

Prodigy Platinum Learning Partner

Institute of IT Training - Accredited Training Provider Association of Computer Trainers Valid HTML 4.01 Transitional
Valid CSS Markup

secure online payments - visa - mastercard

Mini sitemap. These are the main areas of our web site. Full sitemap.

Training by application Main information pages See also

Access courses
DreamWeaver courses
Excel courses
MS Project courses
Outlook courses
PowerPoint courses
VBA courses
Word courses
(more...)

Public scheduled courses
On-site training
Closed company courses

Microsoft Office training
Pricing and availability
Training schedule
Training venues

Access training
Dreamweaver training
Excel training
MS Project training
PowerPoint training

London Computer Training
Computer Training London

Microsoft Access training
Microsoft Excel training
Microsoft Project training
Microsoft Outlook training
Microsoft Powerpoint training
Microsoft Word training

Time Management Course London

Interested in Access training? Please see the following pages:
microsoft access courses · microsoft training access course
microsoft+access+training · access courses in london

Training Information

Training Articles

AddThis Social Bookmark Button What's this?
Add to Del.icio.us Add to Facebook Add to Digg Add to Reddit Add to Google Add to Yahoo Add to Diigo Add to Mr. Wong Add to Linkarena Add to Power Oldie Add to Folkd Add to Jumptags Add to Upchuckr Add to Simpy Add to StumbleUpon Add to Slashdot Add to Netscape Add to Furl Add to Spurl Add to Blinklist Add to Blogmarks Add to Technorati Add to Newsvine Add to Blinkbits Add to Ma.Gnolia Add to Smarking Add to Netvouz