Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Random text via Macro button
Hi All
Anyone that can assist with my request will be greatly thanked. I have a button that generate a random number in a given cell, now is it possible to have a button that will display text upon clicking it? It will off course be pre-typed text that will be randomized. thanks all |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Random text via Macro button
Hi,
Have a look here on how to produce random text strings http://www.vbaexpress.com/kb/getarticle.php?kb_id=110 Mike "Markv" wrote: Hi All Anyone that can assist with my request will be greatly thanked. I have a button that generate a random number in a given cell, now is it possible to have a button that will display text upon clicking it? It will off course be pre-typed text that will be randomized. thanks all |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Random text via Macro button
thanks Mike appreciate it very much.
How do I implement this to a button? And one last question. I have heard of there is a way to display pre-typed text in a window that appears every now and then and disappears again. Is this possible? "Mike H" wrote: Hi, Have a look here on how to produce random text strings http://www.vbaexpress.com/kb/getarticle.php?kb_id=110 Mike "Markv" wrote: Hi All Anyone that can assist with my request will be greatly thanked. I have a button that generate a random number in a given cell, now is it possible to have a button that will display text upon clicking it? It will off course be pre-typed text that will be randomized. thanks all |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
Random text via Macro button
Hi,
With apologies to the original author the function can be converted to a sub like this. Put this in a general module and then from the worksheet:- View toolbars forms Click the button icon on the 'Forms' toolbar and put a button on your sheet. Select 'This Workbook' in the dropdown and select the macro called RL and click OK Clicking the button will put the random string in the active cell. is a way to display pre-typed text in a window that appears every now and then and disappears again. I don't understand what is means Option Explicit Sub RL() Dim Cnt1 As Integer Dim Cnt2 As Integer Dim MySet As Integer Dim Rand As String Dim i As Integer, RndNo As Integer, XSet As Integer Dim MyCase As Integer Cnt1 = Range("A1").Value Cnt2 = Range("A2").Value MySet = Range("A3").Value Application.Volatile Select Case MySet Case Is = "1" 'Upper case MyCase = 65: XSet = 26 Case Is = "2" 'Lower Case MyCase = 97: XSet = 26 Case Is = "3" 'Leading Capital MyCase = 97: XSet = 26 Case Is = "4" 'Text digits MyCase = 48: XSet = 10 Case Is = "5" 'Numeric digits MyCase = 48: XSet = 10 End Select If MySet = 3 Then 'Set leading character of "Name" i = i + 1 Randomize Rand = Rand & Chr(Int((26) * Rnd + 65)) End If 'Set random length of string RndNo = Int((Cnt2 + 1 - Cnt1) * Rnd + Cnt1) Do i = i + 1 Randomize Rand = Rand & Chr(Int((XSet) * Rnd + MyCase)) Loop Until i = RndNo ActiveCell.Value = Rand 'Convert string to number If MySet = 5 Then ActiveCell.Value = ActiveCell.Value * 1 End Sub "Markv" wrote: thanks Mike appreciate it very much. How do I implement this to a button? And one last question. I have heard of there is a way to display pre-typed text in a window that appears every now and then and disappears again. Is this possible? "Mike H" wrote: Hi, Have a look here on how to produce random text strings http://www.vbaexpress.com/kb/getarticle.php?kb_id=110 Mike "Markv" wrote: Hi All Anyone that can assist with my request will be greatly thanked. I have a button that generate a random number in a given cell, now is it possible to have a button that will display text upon clicking it? It will off course be pre-typed text that will be randomized. thanks all |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I set up a "Random Number" button in Excel? | Excel Worksheet Functions | |||
Random Names and Command Button | Excel Worksheet Functions | |||
use button to return random numbers | Excel Worksheet Functions | |||
Macro stops at random places. | Excel Discussion (Misc queries) | |||
Random number Macro | Excel Discussion (Misc queries) |