Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 37
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 37
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I set up a "Random Number" button in Excel? jnoriega Excel Worksheet Functions 2 April 22nd 23 09:01 AM
Random Names and Command Button TotallyConfused Excel Worksheet Functions 1 December 15th 07 03:23 AM
use button to return random numbers jimE Excel Worksheet Functions 1 November 8th 07 11:04 PM
Macro stops at random places. Jeff Excel Discussion (Misc queries) 0 May 16th 07 02:38 AM
Random number Macro Mike Rogers Excel Discussion (Misc queries) 4 February 25th 06 03:27 AM


All times are GMT +1. The time now is 02:16 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"