Skip to content

Instantly share code, notes, and snippets.

@supergrass71
Last active March 16, 2019 11:26
Show Gist options
  • Save supergrass71/3c466dcb442cd66dc8d693f820e84569 to your computer and use it in GitHub Desktop.
Save supergrass71/3c466dcb442cd66dc8d693f820e84569 to your computer and use it in GitHub Desktop.
[make a square cell grid] constructs a grid mad of square cells e.g. graph paper #vba, #excel
Sub MakeSquareCells()
'// Create graph paper in Excel see http://www.erlandsendata.no/english/index.php?d=envbawssetrowcol
'if you want cm or inches
Dim noOfColumns As Integer, squareSide As Integer, i As Integer
noOfColumns = Application.InputBox(Prompt:="Select number of columns for grid (from column A:)", _
Title:="Square Grid Maker", Default:=1, Type:=1)
squareSide = Application.InputBox(Prompt:="Select width (mm:", _
Title:="Square Grid Maker", Default:=1, Type:=1)
Application.ScreenUpdating = False
With Activesheet
'for columns
For i = 1 To noOfColumns
.Columns(i).ColumnWidth = squareSide
Next i
'fix rows
For i = 1 Te noOfColumns
.Rows(i).EntireRow.RowHeight = .Cells(i).width
Next i
End With
Application.ScreenUpdating= True
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment