View Single Post
 
Old 08-11-2012, 07:40 AM
Jamtart Jamtart is offline Windows 7 64bit Office 2010 64bit
Advanced Beginner
 
Join Date: Apr 2012
Posts: 53
Jamtart is on a distinguished road
Default

Hi John, I did find this one and it works great:
Sub UpdateRandomNumber(oSh As Shape)
oSh.TextFrame.TextRange.Text = CStr(Random(12))
SlideShowWindows(1).View.GotoSlide (SlideShowWindows(1).View.Slide.SlideIndex)
End Sub

Function Random(High As Long) As Long
Randomize
Random = Int((High * Rnd) + 1)
End Function


No I need to find a way to get this randomly generated number to interact with other numbers. This is an electrical exersize and the formulas are based on Ohms law. The circuit will have 120 V applied, and two resistors in series, the reistance of one resistor is the Randomly generated number and the other I would keep at 100 ohms at this time. so the formulas/results that I would be looking to have work on the screen would be:
1. Total resistance - Randomly generated number plus 100
2. Current - 120 divided by Total resistance
3. Volt drop 1, which is the resistor having the Randoml generated number - Current times the randomly generated number
4. Volt drop 2, which is my static resistor of 100 ohms - Current time 100

I am trying to learn VBA and this would go a long way to doing that as well as a spring board to other similiar projects.
Reply With Quote