+ Reply to Thread
Results 1 to 2 of 2

return random letters - an example

  1. #1
    aztecbrainsurgeon@yahoo.com
    Guest

    return random letters - an example

    No question here just a procedure for the archive.

    Return a random letter for each cell in selection

    Sub RandomLetterGenerator()

    'Returns a random letter in each cell in selection
    On Error Resume Next
    Selection.FormulaR1C1 = "=CHAR(TRUNC(RAND()*26+65))"

    'Paste value the formulas

    Selection.Copy

    Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, _
    SkipBlanks:=False, Transpose:=False
    Application.CutCopyMode = False

    End Sub

    search criteria
    return random letters
    insert random letters
    generate random letters


  2. #2
    Bernie Deitrick
    Guest

    Re: return random letters - an example

    Just so that this doesn't appear unanswered, one comment: no need for the pastespecial:

    Sub RandomLetterGenerator2()
    'Returns a random letter in each cell in selection
    Selection.FormulaR1C1 = "=CHAR(TRUNC(RAND()*26+65))"
    Selection.Value = Selection.Value
    End Sub

    HTH,
    Bernie
    MS Excel MVP


    <aztecbrainsurgeon@yahoo.com> wrote in message
    news:1125420984.897994.110160@o13g2000cwo.googlegroups.com...
    > No question here just a procedure for the archive.
    >
    > Return a random letter for each cell in selection
    >
    > Sub RandomLetterGenerator()
    >
    > 'Returns a random letter in each cell in selection
    > On Error Resume Next
    > Selection.FormulaR1C1 = "=CHAR(TRUNC(RAND()*26+65))"
    >
    > 'Paste value the formulas
    >
    > Selection.Copy
    >
    > Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, _
    > SkipBlanks:=False, Transpose:=False
    > Application.CutCopyMode = False
    >
    > End Sub
    >
    > search criteria
    > return random letters
    > insert random letters
    > generate random letters
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1