Thursday, February 9, 2012

lecture 4


HW: Do the editor and arrays section on codeAcademy
Also, give me the Excel formulas to convert a lowercase letter to capital
Also, give me the VBA code to convert a lowercase letter to capital


The VBA from class
number = 42
? number
 42 
? number / 2
 21 
? number % 10
? number Mod 10
 2 
myString = "hello"
? myString
hello
? Left(myString, 2)
he
? Left("hello", 2)
he
? Right("hello", 2)
lo
? Right(myString, 2)
lo
? Mid("hello", 2, 3)
ell
? Mid(myString, 2, 3)
ell
three = Left("Joshua", 3)
? three
Jos
three = Mid("Joshua", 1, 3)
? three
Jos
? replace("coding rules", "coding", "programming")
programming rules
result = replace("coding rules", "coding", "programming")
? result
programming rules
? Upper("hello")
? toupper("hello")
? UCase("Hello")
HELLO
? LCase("Hello")
hello
? chr(65)
A
? Asc("A")
 65 
letter = "A"
? letter
A
theCode = Asc(letter)
? theCode
 65 
theCode = theCode + 32
? theCode
 97 
letter = Chr(theCode)
? letter
a
A1 = "A"
? A1
A
A2 = Asc(A1)
? A2
 65 
A3 = A2 + 32
? A3
 97 
A4 = Chr(A3)
? A4
a
letter = "a"
? Chr(Asc(letter) + 32)
a
? Chr(Asc(letter) - 32)
A
letter = "a"
theCode = Asc(letter)
theCode = theCode - 32
letter = Chr(theCode)
? letter
A
? "Hello" = "hello"
False
option compare text
? UCase("Hello") = UCase("hello")
True
? "hello" & "world"
helloworld
? "hello" & " " & "world"
hello world
? "hello" & chr(44) & chr(32) & "world"
hello, world
? "hello" & chr(10) & "world"
hello
world
? format("140000", "$#,##0.00")
$140,000.00

No comments:

Post a Comment