Thursday, December 3, 2009
Moving
I'm moving this blog to http://techperdiem.blogspot.com for ease of management. See you there.
Tuesday, December 1, 2009
Function that returns value in VBA
To code a function that returns value to the calling sub, use FunctionName as the VariableName in the function.
e.g.
function findrownbr()
findrownbr=10
end function
sub readCellData ()
cell_nbr = findrownbr()
msgbox Range("A" &cell_nbr)
end sub
e.g.
function findrownbr()
findrownbr=10
end function
sub readCellData ()
cell_nbr = findrownbr()
msgbox Range("A" &cell_nbr)
end sub
Newline Character in VBA
Chr(13) inserts a new line character in vb.
Output
there is
newline between this and the line above.
Code
"there is a" & Chr(13) & "newline between this and the line above."
Note
Chr(13) should not be in quotes.
Output
there is
newline between this and the line above.
Code
"there is a" & Chr(13) & "newline between this and the line above."
Note
Chr(13) should not be in quotes.
Subscribe to:
Posts (Atom)