writing in vba

P

paul

does anyone no how to answer a proposed question like this. I was
looking through some old papers for next years module in this. As im
doing this as a module on my course and I want to get a head start in
understanding how to write this in essay formats.

any hints or clues would be very grateful in how to approach this. as
this will be helpful next year


I also want you to redo the continuous assessment assignment - but an
easy one this time. I require you to write a program that takes a
number,x, from cell A3 and a positive integer, n, from cell B3 then
returns into cell C3 the value of x raised to the power n divided by
n factorial. I will award you bonus marks if you put in some error
checking to ensure that a negative value of n cannot be used. Note
that x can be positive or negative. This will be examined orally on
the day of your examination, but should only take a few minutes
 
G

Guest

I'm not a mathematician, but maybe this is what you are looking for?

In cell C3 enter the following formula
=IF(B3="","",IF(B3<=0,"Integer in B3 must be positive",(A3^B3)/B3))
 
H

Helmut Weber

Hi Kassie,
=IF(B3="","",IF(B3<=0,"Integer in B3 must be positive",(A3^B3)/B3))

works perfectly, but
in essay formats !

is there no cell format "essay"?

;-)

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 
P

paul

sorry its just a VBA programme, not an essay. so for all of that is
that all i would need to write in the programme. ?

how would i get bonus marks for error checking to ensure that a
negative value on "n" cannot be used?


thanks
 
G

Guest

Hi Helmut,

I took it that the poster meant "in easy format". Have no clue what "essay
format" would mean! Obviously, if he had to write an essay containing the
answer, then a little (maybe a lot) of meat around the formula would be
required. In the essay you would most likely have to explain your reasoning,
both as far as the error checking is concerned, as well as as far as the
actual exponential formula is concerned. Cannot for the life of me however,
figure out why a person would be required to write an essay about practical
Excel work?

If the poster really wants info on an "essay format", I would suggest that
he posts again. Maybe that would put more light on the issue, and we could
then be able to better assist him?
 
R

Rick Rothstein \(MVP - VB\)

I'm not a mathematician, but maybe this is what you are looking for?
In cell C3 enter the following formula
=IF(B3="","",IF(B3<=0,"Integer in B3 must be positive",(A3^B3)/B3))

There are two reasons why I don't think that is what 'paul' was looking
for....

First, the division should be by FACT(B3), not just B3. Although quite
frankly, the wording of the original problem left me wondering what was to
be divided... the exponent or the number raised to the power. I think your
interpretation is the correct one, but the wording of the problem seemed
sloppy to me.

The second reason I don't think this is what 'paul' wanted is the more
important of the two reasons... his Subject indicates the course is a VBA
one and the assignment said "I require you to write a program..."<g>

I was of a mixed mind about posting code to do this. I think it would be
better for 'paul' to tackle this when it comes up in his class and **try**
to work out the details for himself. Besides, I am not sure posting code
before he is ready for it will be all that instructive at this point in time
and the temptation for him to use it as-is instead of trying to figure it
out on his own might be too great when he is ready for it.

Rick
 
G

Guest

Your error checking is contained in the piece "IF(B3<=0,"Integer in B3 must
be positive",". This portion checks the value of B3. If that value is less
than or equal to 0, it pops the message in quotes, but if the integer in B3
is greater than 0, therefore 1 or higher, it will doe the calculation.
 
G

Guest

Must say though, that the answer I provided is not VBA, but simply a formula
entered into cell C3? Do you really need a VBA routine to achieve the
result? Even then, I would merely use VBA to insert the formula in C3. Any
changes to A3 or B3 would then still be handled by the formula, and not by
VBA?
 
H

Helmut Weber

Hi Kassie,

LOL,

the poster would like you to write an essay for him.
Not just a formula, but all steps in detail
which lead you to the solution.

In short, Paul would appreciate if you did his homework.

Have a nice day.

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 
G

Guest

Hi Rick

Thanks for your comments! As I said in the beginning, I am not a
mathematician. Instead of Maths, my parents made me study lingua Latina, and
I have rued it ever since! Looking at Paul's response though, I agree that
he should wait until this comes up in his course, before attempting to answer
it! I say this with a lot of compassion, based on the fact that he could not
recognise the error checking part of the formula.

However, I do not believe that I am in a position to make statements like
that, to persons I do not know, in spite of the fact that such person's
problem description capabilities fall short in any respect whatsoever! I
participate in these groups to assist where I can, even when it is sometimes
difficult to understand a poster's original questions.

I appreciate it that an MVP has a lot more knowledge than me, and I
understand if you wish to make such statements, but I have never ever
believed in judging any one!

Kind regards
 
G

Guest

Hi Helmut

What do you suggest?

Should we all stop responding to problems posted on this website? It would
then seem as if every one is too lazy to use their brains, and therefore use
this forum to get us to do their work? Hell, I always understood that that
was the purpose of these forums! People who do not have the answers make use
of the forums to get replies from people who do know the answers, and in that
way we all gain from individual experiences, etc.

I take it that you personally know Paul, and that that is the reson why you
make such allegations against him. That now apart from the fact that you
misread his post, since he is clearly not looking for an essay. It would
however seem that he meant "easy".

This kind of attitude, especially from an MVP, in my view is totally unasked
for. In my view, you are supposed to be an MVP becuase you can contribute to
forums like these. And hell, if you do not want to contribute, then don't!
It would be better than making derogaratory remarks.

You know what Helmut, even if Paul wanted me to do his homework, as you put
it, I would still answer his question to the best of my ability, instead of
insulting him. I now wonder whether you can tell me what the opposite of MVP
would be?
Maybe a UBP, or would DSMP be a better description? A hint, the S would
stand for selfrighteous.
 
G

Guest

but I have never ever
believed in judging any one!

That statement is a little inconsistent with your rant to Mr. Weber who
never suggested you not answer the question. He just made a reasonable
observation that Paul wanted you to do his homework and you responsed with a
rant that had little to do with Mr. Weber's two postings and appeared to make
several judgements about Mr. Weber. At least that is the way it appeared to
me, a disinterested observer, and I assume I am allowed to recount what I
observed.
 
G

Guest

Hi Paul,

This is the second question of this sort that I've read posted from you. I
don't want to sound mean, and am being totally sincere, but do you not think
that you would gain more from tackling these things yourself, and it would
probably make your degree more worthwhile? These really are fairly simple
tasks, and as someone studying at university, I don't doubt that you have the
ability to tackle them, if only you would put your mind to it. You'll gain
far more from working out the solutions yourself than getting others to do
the thinking for you.

Again, I don't want to sound harsh, I just think it's in your best interest.

All the best with your studies,

Sean.
 
H

Helmut Weber

Thank you, Tom

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

vba 1
vba hint 1
programming help 2
PROGRAMME HELP 2
vba 2
running varibiables into vba 1
continous assessment help with vba 1
vba coding 3

Top