Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 05-02-2018, 02:11 PM
dwirony dwirony is offline Fill Derby pool squares Windows 7 64bit Fill Derby pool squares Office 2003
Advanced Beginner
 
Join Date: Oct 2016
Posts: 49
dwirony will become famous soon enough
Default

Here you go - this should work for you:

Code:
Sub Test()

Dim i As Long, x As Long, y As Long, initials As String, numberofsquares As String

initials = Application.InputBox("What are the initials?")
numberofsquares = Application.InputBox("How many squares?")

Do Until i = numberofsquares
    x = Application.WorksheetFunction.RandBetween(2, 20)
    y = Application.WorksheetFunction.RandBetween(4, 8)
    
    If Cells(x, y).Value = "" Then
        Cells(x, y).Value = initials
        i = i + 1
    End If
Loop

End Sub
NOTE: This will crash if the number of squares you enter is greater than the number left - I can add something to catch that for you if you need it, I've just given you the basic shell here.
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Fill Derby pool squares Microsoft word Page has 4 quarter squares on each paper AZn Word 3 05-18-2017 07:50 AM
Email displaying squares instead of text glenforum Outlook 3 01-15-2013 09:14 AM
Corrupt file. My entire manuscript just turned into small squares. wytxny Word 2 05-03-2012 07:13 AM
Use only rsource pool gdallas Project 0 11-25-2010 01:10 PM
The characters of my received emails are little squares! HELP! chocolatecookies Outlook 0 12-17-2008 04:17 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:13 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft