Programming

Programming questions? Ask a programmer for answers ASAP

Ask a Computer Expert,
Get an Answer ASAP!

IterationCounter is declared Publically and As Integer at…

Customer Question
IterationCounter is declared Publically and...
IterationCounter is declared Publically and As Integer at the start of the program
Procedure 1 starts by updating the counter with
IterationCounter = IterationCounter +1
If IterationCounter < 50, Then Call Procedure2 Else Call Procedure3
This conditional get a syntax error (without analysis) and the program quits
Can you help? Palmer.
Submitted: 2 years ago.Category: Programming
Show More
Show Less
Ask Your Own Programming Question
Answered in 1 hour by:
9/4/2015
Programmer: Zabo04, Programming Enthusiast replied 2 years ago
Zabo04
Zabo04, Programming Enthusiast
Category: Programming
Satisfied Customers: 284
Experience: C/C++, python, perl, excel, matlab/octave, java, and R experience. Genetic algorithm, vision, GUIs.
Verified

After the line "Call Procedure3" you need and "End If".

Ask Your Own Programming Question
Customer reply replied 2 years ago
That does NOT change the result. When I run the compiler, it still returns the code in red. (Red is my option to highlight bad code.) So, in other words, the result is identical with or without the End If. To be sure you and I are on the same page, here is the exact syntax again:If IterationCounter < 360 Then Call EarlyPlot Else Call Plot.Note: in my original statement of the problem I used Procedure2 and Procedure3.To emphasize again, this is Excel 2010 running under Windows 7 64bit.Thanks. Palmer.
Programmer: Zabo04, Programming Enthusiast replied 2 years ago

Okay, regardless you need an End If for VBA code.

Ask Your Own Programming Question
Programmer: Zabo04, Programming Enthusiast replied 2 years ago

This code works for me:

Sub Test1()

IterationCount = 52

If IterationCount < 50 Then
EarlyPlot
Else
Plot
End If
End Sub

Sub EarlyPlot()
Range("A1").Value = "Early Plot"
End Sub

Sub Plot()
Range("A1").Value = "Plot"
End Sub

Ask Your Own Programming Question
Programmer: Zabo04, Programming Enthusiast replied 2 years ago

Sub Test1()

IterationCount = 52

If IterationCount < 50 Then
EarlyPlot
Else
Plot
End If

End Sub

Sub EarlyPlot()
Range("A1").Value = "Early Plot"
End Sub

Sub Plot()
Range("A1").Value = "Plot"
End Sub

Ask Your Own Programming Question
Programmer: Zabo04, Programming Enthusiast replied 2 years ago

Okay Justanswer will hold returns but not spaces or tabs, so the alignment is not pretty, but that code runs. Basically, End If and drop the call. Now are all of your procedures/subs in the same worksheet?

Ask Your Own Programming Question
Customer reply replied 2 years ago
OK let's table it until Tuesday because I cannot make a realistic test until I again have streaming stock market data.However, I am remain doubtful. If I put in the End If, the compiler then responds by wanting a rearrangement of my single line into a block with the If at the top and then it converts the Else phrase to a highlighted "Else:" before the Call procedure. And it does that automatically. Could it be that I have a non-standard set up under Options for my VBA? Or that we are talking about different versions of Excel and VBA? Thanks again. Palmer.
Programmer: Zabo04, Programming Enthusiast replied 2 years ago

If then else end if is straight VBA and version irrelevant.

Ask Your Own Programming Question
Programmer: Zabo04, Programming Enthusiast replied 2 years ago

Get rid of the keyword call, you don't need it. Check where your procedures are defined, they may be out of scope.

Ask Your Own Programming Question
Programmer: Zabo04, Programming Enthusiast replied 2 years ago

I copied and pasted out of Excel VBA, and it ran and changes the cell value. I can send you a .xlsm file.

Ask Your Own Programming Question
Programmer: Zabo04, Programming Enthusiast replied 2 years ago

Here is the link, everything is in sheet1: http://www.mediafire.com/view/7ygkk4uuya18wfn/if_test.xlsm

Ask Your Own Programming Question
Customer reply replied 2 years ago
OK Zabo04 Please note the following works and IS NOT according to your guidance. Perhaps instead of being so dogmatic you should learn something from your customers, maybe you guys should pay me. Here is the code that works: If IterationCounter < X Then Call Procedure1 Else Call Procedure2. The whole reason it would not compile was that I was trying to modify a program which had been open and which had On.Time statements still active. As soon as I closed the entire application of Excel and thereby cleared all of the relevant RAM, and then reopened Excel and reloaded the files, then the program compiled and today I tested it with real streaming data. Therefore, the next time you have a prepaid client do not try to hammer him, instead try humility and issue the caution about pre-existing On. Time statements. I decline to rate you. Thank you. Palmer Hinsdale
Programmer: Zabo04, Programming Enthusiast replied 2 years ago

I apologize for your answer not being in accordance with my guidance. I would ask you to consider that what I provided does run on my machine while your provided code did not run. Per Microsoft's technotes End If is the correct usage of the if then conditional flow. You provided with only four lines of code, which did not have any time statements, so I had no way of knowing you were using them. I have only the information you give me to solve your problem. Also, I did not "hammer you", I was clear and direct in what was compiling on my machine. You may proceed with ratings as you wish, you are the customer, but in the future it would be of great help for you to be more interactive and provide more information, or a sample of the actual code. I did provide code, you did not. Personally, pre-paid or not makes no difference to me. I have a higher acceptance rate than the average expert on this site by a factor of 2 and I have a statistically significant higher percent of repeat customers. I will make note of your username so I do not answer you in the future.

Ask Your Own Programming Question
Programmer: Zabo04, Programming Enthusiast replied 2 years ago

Because I do listen to my customers, here is a screenshot of the compile error without the End If when I tried to run it without as you say works. I noticed there was no End If in what you provided, not based on doctrine, but based on the fact that after a stint of Python or C++ between VBA projects I try to use semi-colons and forget the End If and get the error regularly.

Ask Your Own Programming Question
Customer reply replied 2 years ago
Look, I have used Excel VBA for years, but I am not so arrogant to assert that I know everything, because what I do know for sure is that no person has a monopoly on brains, and people who think they could be so afflicted (I am talking about you) are the very persons who do not have a monopoly on brains. I made it work my way and it rejects your way; you can make it work your way. Under those circumstances, I wonder if the fact that I am running Excel 2010 on Windows 7 64 bit could be the clue. You may be sure that I will never use JustAnswer again, so you will never be burdened by having to deal with me. Just for your info, the prior time that I used JustAnswer, the answer turned out to be a question of 64bit vs 32bit. Thank you for your attempt to help me; it was of no value. And, I will not play your game of trying to enhance the statistically significance of your ratings. Thank you, ***** *****
Was this answer helpful?

How JustAnswer works

step-image
Describe your issueThe assistant will guide you
step-image
Chat 1:1 with a programmerLicensed Experts are available 24/7
step-image
100% satisfaction guaranteeGet all the answers you need
Ask Zabo04 Your Own Question
Zabo04
Zabo04
Zabo04, Programming Enthusiast
Category: Programming
Satisfied Customers: 284
284 Satisfied Customers
Experience: C/C++, python, perl, excel, matlab/octave, java, and R experience. Genetic algorithm, vision, GUIs.

Zabo04 is online now

A new question is answered every 9 seconds

How JustAnswer works:

  • Ask an ExpertExperts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional AnswerVia email, text message, or notification as you wait on our site. Ask follow up questions if you need to.
  • 100% Satisfaction GuaranteeRate the answer you receive.

JustAnswer in the News:

Ask-a-doc Web sites: If you've got a quick question, you can try to get an answer from sites that say they have various specialists on hand to give quick answers... Justanswer.com.
JustAnswer.com...has seen a spike since October in legal questions from readers about layoffs, unemployment and severance.
Web sites like justanswer.com/legal
...leave nothing to chance.
Traffic on JustAnswer rose 14 percent...and had nearly 400,000 page views in 30 days...inquiries related to stress, high blood pressure, drinking and heart pain jumped 33 percent.
Tory Johnson, GMA Workplace Contributor, discusses work-from-home jobs, such as JustAnswer in which verified Experts answer people’s questions.
I will tell you that...the things you have to go through to be an Expert are quite rigorous.

What Customers are Saying:

My Expert answered my question promptly and he resolved the issue totally. This is a great service. I am so glad I found it I will definitely use the service again if needed.

One Happy CustomerNew York

Wonderful service, prompt, efficient, and accurate. Couldn't have asked for more. I cannot thank you enough for your help.

Mary C.Freshfield, Liverpool, UK

This expert is wonderful. They truly know what they are talking about, and they actually care about you. They really helped put my nerves at ease. Thank you so much!!!!

AlexLos Angeles, CA

Thank you for all your help. It is nice to know that this service is here for people like myself, who need answers fast and are not sure who to consult.

GPHesperia, CA

I couldn't be more satisfied! This is the site I will always come to when I need a second opinion.

JustinKernersville, NC

Just let me say that this encounter has been entirely professional and most helpful. I liked that I could ask additional questions and get answered in a very short turn around.

EstherWoodstock, NY

Thank you so much for taking your time and knowledge to support my concerns. Not only did you answer my questions, you even took it a step further with replying with more pertinent information I needed to know.

RobinElkton, Maryland

< Previous | Next >

Meet the Experts:

ATLPROG

ATLPROG

Computer Software Engineer

7,677 satisfied customers

MS in IT.Several years of programming experience in Java C++ C C# Python VB Javascript HTML

LogicPro

LogicPro

Computer Software Engineer

7,175 satisfied customers

Expert in C, C++, Java, DOT NET, Python, HTML, Javascript, Design.

unvadim

unvadim

Computer Software Engineer

1,168 satisfied customers

Good knowledge of OOP principles. 3+ years of programming experience with Java and C++. Sun Certified Java Programmer 5.0.

lifesaver

lifesaver

Computer Software Engineer

950 satisfied customers

Several years of intensive programming and application development experience in various platforms.

ehabtutor

ehabtutor

Computer Software Engineer

936 satisfied customers

Bachelor of computer science, 5+ years experience in software development, software company owner

TheDoctor

TheDoctor

Software Engineer

893 satisfied customers

M.S. in Internet Information Systems

The-PC-Guy

The-PC-Guy

Software Engineer

848 satisfied customers

Extensive Knowledge in PHP, MYSQL, CSS & Javascript

< Previous | Next >

Related Programming Questions
1. (TCO 5) A _____ repeats actions until a certain condition
1. (TCO 5) A _____ repeats actions until a certain condition is met. (Points : 3) repetition structure control structure selection structure sequence structure 2. (TCO 5) You are writing a For…Next lo… read more
LogicPro
LogicPro
Computer Software Engineer
Bachelor of Technology
7,175 satisfied customers
I am using VS 2008 and writing code in VB. I am opening a
I am using VS 2008 and writing code in VB. I am opening a a notepad application from my VB program and need to keep the notepad application topmost. I have been attempting to use the "SetWindowPos " f… read more
Michael Hannigan
Michael Hannigan
Bachelor\u0027s Program
239 satisfied customers
**For TheDoctor** Here a scenario> I need to be able to
**For TheDoctor** Here a scenario> I need to be able to update different record based on the result of a first query. If the first query does not return any record then no update is done and we mov… read more
TheDoctor
TheDoctor
Software Engineer
Master's Degree
893 satisfied customers
Problem initialising (registering) DLL - USB interface
Problem initialising (registering) DLL - USB interface from (www.pc-control.co.uk) ******Information given by USB minibee interface Instructions****** ** Place mb.dll in c:\windows\system32 ** Declare… read more
AAATom
AAATom
Software Engineer
Master\u0027s Degree
42 satisfied customers
1. Reading and understanding code what is the output of this
1. Reading and understanding code what is the output of this code sequence? int [] a = { 12, 48, 65 }; for ( int i = 0; i < a.length; i++) System.out.println( "a[" + i + "] = " + a ); 2. fill in co… read more
ATLPROG
ATLPROG
Computer Software Engineer
Master's Degree
7,677 satisfied customers
Create a program that copies into two parallel arrays from
Create a program that copies into two parallel arrays from a sequential file a word in English and in the other array, the word in Spanish. The words are provided below the instructions. Allow the use… read more
LogicPro
LogicPro
Computer Software Engineer
Bachelor of Technology
7,175 satisfied customers
To Ingo U, Can you please answer the following questions
To Ingo U, Can you please answer the following questions for me in depth. Thanks in advance. How do you declare a variable in Visual Basic? What does the declaration do? What effect does the location … read more
Ingo U
Ingo U
Master\u0027s Degree
358 satisfied customers
Reply STEP 1 Create Input Arrays Create an array for each
Reply STEP 1: Create Input Arrays Create an array for each of the input values and store the values into the appropriate array as they are read in from the keyboard. The gross and net pay calculations… read more
Nilesh
Nilesh
Bachelor\u0027s Degree
649 satisfied customers
#1) Write a C++ class called RationalNumber. Provide both the
I have 6 questions that need to be answers that involves programming and example of answers. I will resubmit them when I here from you. I do give a bonus.… read more
DLUF00
DLUF00
Master's Degree
12 satisfied customers
If possible, send this to John D . . . he has helped me with
If possible, send this to John D . . . he has helped me with several similar issues. I have an attached (or will try to) an excel spreadsheet with VBA code behind the scenes. The OrderEntryForm is whe… read more
John D
John D
Bachelor Degree in Engineering
400 satisfied customers
What is a function procedure in Visual Basic How is
What is a function procedure in Visual Basic? • How is it different from a sub procedure? • Give an example of a potential function that one could use in VB.NET.… read more
Ramesh Patil
Ramesh Patil
Master's Degree
417 satisfied customers
Design a program that uses nested loops to collect data and
Design a program that uses nested loops to collect data and calculate the average rainfall over a period of years. The program should first ask for the number of years. The outer loop will iterate onc… read more
Tony
Tony
Staff Engineer, Wireless Platform
Bachelor\u0027s Degree
88 satisfied customers
Find the Error I need it to show the corrected way. 2.
Find the Error I need it to show the corrected way. 2. Class-level declaration in frmResults Dim intNumber as Integer Statements in another form Dim resultsForm as New frmResults() resultsForm.intNumb… read more
Jeff Ptak
Jeff Ptak
Business Intelligence Architect
Bachelor\u0027s Degree
120 satisfied customers
What Do You Think 4. Suppose you have written a function,
What Do You Think 4. Suppose you have written a function, named CircleArea, which returns the area of a circle. You call the function from numerous procedures in different form modules. Should you sto… read more
Sandip Patil
Sandip Patil
Master's Degree
how do I write a pseudocode that initializes a counter and
how do I write a pseudocode that initializes a counter and an accumulator before entering a loop. investment 10000 annually, loop 40 times and output the accumulated total for years 10, 20, 30 and 40?… read more
Raj
Raj
SAP ABAP Consultant
Master\u0027s Degree
841 satisfied customers
Design a function that uses recursion to raise a number to
Design a function that uses recursion to raise a number to a power. The function should accept two arguments: the number to be raised and the exponent. Assume that the exponent is a nonnegative intege… read more
Hirash Riyal
Hirash Riyal
Higher Diploma In IT
174 satisfied customers
Look for ways to modularize the following algorithm and modify
Look for ways to modularize the following algorithm and modify it accordingly. Declare selection as int Display "Menu" Display "1. Open a new document." Display "2. Close the current document." Displa… read more
ehabtutor
ehabtutor
Computer Software Engineer
Bachelor's Degree
936 satisfied customers
Write a pseudocode statement that generates a random number
Write a pseudocode statement that generates a random number in the range of 1 through 100 and assigns it to a variable named rand.… read more
.Paul
.Paul
VB.Net technician
38 satisfied customers
Disclaimer: Information in questions, answers, and other posts on this site ("Posts") comes from individual users, not JustAnswer; JustAnswer is not responsible for Posts. Posts are for general information, are not intended to substitute for informed professional advice (medical, legal, veterinary, financial, etc.), or to establish a professional-client relationship. The site and services are provided "as is" with no warranty or representations by JustAnswer regarding the qualifications of Experts. To see what credentials have been verified by a third-party service, please click on the "Verified" symbol in some Experts' profiles. JustAnswer is not intended or designed for EMERGENCY questions which should be directed immediately by telephone or in-person to qualified professionals.

Disclaimer: Information in questions, answers, and other posts on this site ("Posts") comes from individual users, not JustAnswer; JustAnswer is not responsible for Posts. Posts are for general information, are not intended to substitute for informed professional advice (medical, legal, veterinary, financial, etc.), or to establish a professional-client relationship. The site and services are provided "as is" with no warranty or representations by JustAnswer regarding the qualifications of Experts. To see what credentials have been verified by a third-party service, please click on the "Verified" symbol in some Experts' profiles. JustAnswer is not intended or designed for EMERGENCY questions which should be directed immediately by telephone or in-person to qualified professionals.

Show MoreShow Less

Ask Your Question

x