View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_3_] Dave Peterson[_3_] is offline
external usenet poster
 
Posts: 2,824
Default Fill MT cells in a range

And using KeepItCool's code:

Option Explicit
Sub FillPuzzle2()

Dim c As Range
Dim myRng As Range

Set myRng = Nothing
On Error Resume Next
Set myRng = Intersect(Selection, _
Selection.Cells.SpecialCells(xlCellTypeBlanks))
On Error GoTo 0

if myrng is nothing then
msgbox "No empty cells in selection"
exit sub
end if

Randomize
For Each c In myRng.Cells
c = Chr$(64 + Int(26 * Rnd + 1))
Next c
End Sub

Select your range and run the code.



Biff wrote:

Hello Folks!

My VBA knowledge is slim to none so I need a little help
with a macro.

I would like a macro that fills MT cells in a range with
random uppercase letters A-Z. The cells will not always be
contiguous. I'm playing around with a word search puzzle
and looking for a quick way to fill the MT cells.

Thanks for your help
Biff


--

Dave Peterson