excel computer course london - on error statements
Microsoft Office TrainingThe UK's Number 1 for Microsoft Office Training Sitemap add this page to your favourites/bookmarksBookmark page
 
view a printable version of this pagePrintable version
Plus One Google
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

resolvedResolved · Low Priority · Version Standard

replyReplyThu 22 Nov 2007, 12:23Delegate Samantha said...

On error statements

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?

For upcoming training course dates see: Pricing & availability

replyReplyThu 22 Nov 2007, 13:01Delegate Samantha said...

RE: On error statements

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.

 

 

forum postHow do you easily change colours of backgrounds and brushes?

» Forum post: Photoshop


Rate this page:
2.2/5 (213 votes cast)
Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses
Microsoft Certified Partner
Security Seal verified by visa, mastercard securecard

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

Management training

Professional Skills courses
Project Management Course London
Project Management Courses London
Project Management Training London
Project Management Training
Project Seminar
Project Seminars
Time Management Course London
Time Management London
Time Management Courses London
Time Management Training London
Introduction to Finance course
Assertiveness Skills course
Effective Communications Skills training
Presentation Skills London

Training Formats

Public scheduled courses
On-site training
Closed company courses

Consultancy
Application Development

Blogs

Excel Training
MS Project Training
Microsoft Training Blog

Version differences

Office 2010 vs 2007
MS Project version differences

Training Information

London Computer Training
Computer Training London
Docklands Training Courses
Docklands Training London

Training venues London
Client list
FAQ
Pricing and availability
Course details / Syllabus

Training Articles
Training Information

Microsoft training

Microsoft Office training
& IT Applications

Microsoft Project training
Microsoft Outlook training
Microsoft Powerpoint training
Microsoft Word training
MS Project courses
MS Project training
Outlook courses
PowerPoint courses
PowerPoint training
VBA courses
Word courses
Microsoft.training
(more...)

Excel Training

Excel courses
Excel Training Courses Medway
Autonumber in Excel
Microsoft Excel training
Basic Excel Courses
Basic Excel Course
Basic Excel Training

Interested in MS Access training?

Access courses
Microsoft Access training
Microsoft access courses
Microsoft training access course
Microsoft+access+training
Access courses in london

Training provider

Training providers
IT training companies
IT training providers
Management Training providers
Management Training provider

Event history, feedback results
Events in 2012 · 2011 · 2010 · More

See also

Crystal Reports training