<!--[if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:PunctuationKerning/> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:Compatibility> <w:BreakWrappedTables/> <w:SnapToGridInCell/> <w:WrapTextWithPunct/> <w:UseAsianBreakRules/> <w:DontGrowAutofit/> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--> So I have been racking my brain and searching online to find a solution to a excel 2003 macro. With no avail I have not come up with a solution so here is my problem.
I am trying to create a macro that randomly generates a number from range “A” to “B”.
So in cell A1 is a # which is range “A” in cell B1 is a # which is range “B” in cell C1 is the product of the macro the uses the #’s in cells A1 & B1
So say for instance I put 5 in cell A1 and 20 in cell B1 the random number will be between 5-20 but if I change the numbers in cells A1 to 100 and B1 to 3000 cell C1 would generate a number from 100-3000 I want whole numbers only.
I can’t use a Rand function and use F9 because I only want it to generate a number when I run the macro.
I hope someone can help me out with this macro.
Thanks.<!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]--><!--[if !mso]>******** classid="clsid:38481807-CA0E-42D2-BF39-B33AF135CC4D" id=ieooui></object> <style> st1\:*{behavior:url(#ieooui) } </style> <![endif]--><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]-->
I am trying to create a macro that randomly generates a number from range “A” to “B”.
So in cell A1 is a # which is range “A” in cell B1 is a # which is range “B” in cell C1 is the product of the macro the uses the #’s in cells A1 & B1
So say for instance I put 5 in cell A1 and 20 in cell B1 the random number will be between 5-20 but if I change the numbers in cells A1 to 100 and B1 to 3000 cell C1 would generate a number from 100-3000 I want whole numbers only.
I can’t use a Rand function and use F9 because I only want it to generate a number when I run the macro.
I hope someone can help me out with this macro.
Thanks.<!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]--><!--[if !mso]>******** classid="clsid:38481807-CA0E-42D2-BF39-B33AF135CC4D" id=ieooui></object> <style> st1\:*{behavior:url(#ieooui) } </style> <![endif]--><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]-->