Skip to content

Instantly share code, notes, and snippets.

@joseph4tw
joseph4tw / Rack.js
Created June 26, 2017 02:21
Testing this out
function Rack(poolTable, ballRadius) {
var start = new Point(poolTable.length * 3/4, poolTable.height / 2);
function rackEm() {
var ballPositions = [];
for (var row = 1; row <= 5; row++) {
for (var balls = 1; balls <= row; balls++) {
ballPositions.push(new Point(start.x * row, 10)); // unfinished...just testing out gist
@joseph4tw
joseph4tw / Worksheet_Change_Event.vb
Created July 2, 2017 14:03
Worksheet_Change Event Example
Option Explicit
Public Sub Worksheet_Change(ByVal target As Range)
Debug.Print "Something changed in cell " & target.Address(0, 0)
End Sub
Option Explicit
Public Sub Worksheet_Change(ByVal target As Range)
Dim intersection As Range
Set intersection = Intersect(target, Range("A1:B3"))
If Not intersection Is Nothing Then
Debug.Print "Cells that changed: " & target.Address(0, 0), _
vbTab & "Intersection at " & intersection.Address(0, 0)
End If
Option Explicit
Public Sub Worksheet_Change(ByVal target As Range)
Dim intersection As Range
Set intersection = Intersect(target, Range("A1:B3"))
If Not intersection Is Nothing Then
Dim cell As Range
For Each cell In intersection
Option Explicit
Public Sub Worksheet_Change(ByVal target As Range)
Dim intersection As Range
Set intersection = Intersect(target, Range("A1:B3"))
If Not intersection Is Nothing Then
Dim cell As Range
Application.EnableEvents = False
Sub Macro1()
'
' Macro1 Macro
'
'
Range("B1").Select
ActiveCell.FormulaR1C1 = "Hi"
Range("B1").Select
Selection.AutoFill Destination:=Range("B1:B11"), Type:=xlFillDefault
Option Explicit
Public Sub GetCellValue()
Dim val As String
val = Range("A2").Value
Debug.Print val
End Sub
Option Explicit
Public Sub GetCellValue()
Dim cell As Range
Set cell = Range("A2")
Debug.Print cell.Value
End Sub
Option Explicit
Public Sub GetCellValue()
Dim cell As Range
Set cell = Range("A2:A5")
Debug.Print cell.Value ' will throw an error "Type Mismatch"
End Sub
Option Explicit
Public Sub GetCellValue()
Dim cellRange As Range
Set cellRange = Range("A2:A5")
Debug.Print cellRange.cells(1, 1).Value
End Sub