Skip to content

Instantly share code, notes, and snippets.

@drewlesueur
Created June 11, 2012 03:13
Show Gist options
  • Save drewlesueur/2908335 to your computer and use it in GitHub Desktop.
Save drewlesueur/2908335 to your computer and use it in GitHub Desktop.
vba (Visual Basic for Excel)
Sub mycro()
'
' mycro Macro
'
' Keyboard Shortcut: Ctrl+e
'
ActiveCell.FormulaR1C1 = "yo dawg"
Range("I9").Select
Dim ws As Worksheet
' Set ws = Sheets.Add
Set ws = ThisWorkbook.ActiveSheet
' set one value
ws.Range("A1").Value = "yo dawg"
' create variable that is list of values
months = Array("Jan", "Feb", "March", "April", "May")
ws.Range("A1:E1") = months
ws.Range("C2").Value = "=1+2"
'For i = LBound(months) To UBound(months)
' ws.Range("A" & (i + 1)).Value = months(i)
'Next
' theName = InputBox("Enter your name please")
If theName = "Drew" Then
' MsgBox ("please fire him")
Else
' MsgBox ("he can stay")
End If
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment