Excel Visual Basic

By scouser42 ·
Hello everyone

I,m in a bit of a pickle and wondering could anyone help please. I have been asked to create a visual basic programme in excel and as I have never used it before I'm struggling. I thought with the ever mighty internet I may be able to sort something out but nothing so far.
I need to come up with something based on Ohms law i.e input the voltage and current and the programme then tells you the resistance and the wattage of the item.
Every thing I've tried is useless. Could anybody point me in the right direction with this. Any help would be greatly appreciated.
Thanks in advance

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Collapse -

Rule of thumb in this forum, if you want help with code

by ComputerCookie In reply to Excel Visual Basic

post your code first.

A good programmer could look at your code and easily modify it.

A good programmer could look at your question and he doen't know Ohm's Law!!!!

Your problem slacko.

Collapse -

Ohm's law

by jimmy-jam In reply to Rule of thumb in this for ...
Collapse -

Do you need to use VB?

by jimmy-jam In reply to Excel Visual Basic

Or can you just use formula's in Excel?

Collapse -


by scouser42 In reply to Do you need to use VB?

Hi Jimmy Jam

Yes it has to be visual basic and thanks for replying

Collapse -

This should get you started

by jimmy-jam In reply to Thanks

Open Excel - hit Alt + F11
Visual Basic Editor comes up.
Right click on sheet1 and insert user form.
Drag two textbox's and a command button on to the form.
Double click on the command button and the script editor will pop up.
Insert the following code.

Voltage = TextBox1.Text
Current = TextBox2.Text
Resistance = Current / Voltage
Power = Voltage * Current
MsgBox ("Resistance = " & Resistance & vbCr & "Power = " & Power)

Save it. Push the green triangle at the top for the visual basic editor to trial run the form. Input your numbers and you should get a pop up with the values you are looking for.

Note: The above code will only come out right if you make textbox1 volts and textbox2 current. Also you will need to play getting it to launch when you open the workbook. There are some setting which I am not familiar with to get it to launch. If you continue to have problems post back or PM me and I'll see what I can come up with. Good luck.

Collapse -

This may help to visualize

by IC-IT In reply to Excel Visual Basic

your (school?) project.

There are also Ohms caculator programs that could help.
C Code example;

If you are doing a Google Search, you might run across this (don't plaguarize though);

Collapse -

Thanks again

by scouser42 In reply to This may help to visualiz ...

Thank you both so much. Jimmy Jam I'll give it a try and let you know although it will probably be tomorrow that I will be in touch.
Best regards

Related Discussions

Related Forums