Tuesday, February 17, 2015

Must know VBA functions in Excel VBA

1. CCur - Converts an expression to currency data type

2. CDate - Converts an expression to date data type

3. CDbl - Converts an expression to double data type

4. CDec - Converts an expression to decimal data type

5. Choose - Selects and returns a value from a list of arguments

6. Chr - Converts an ANSI value to a character

7. CInt - Converts an expression to integer data type

8. CLng - Converts an expression to long data type

9. Cos - Returns the cosine of a number

10. CVErr - Returns a user-defined error type

11. Date - Returns the current system date

12. DateAdd - Returns a date with a specific date interval added to it

13. DateDiff - Returns the difference between two dates as a time interval

14. DatePart - Returns an integer containing a specific part of a date

15. DateSerial - Returns a date for a specified year, month, and day

16. DateValue - Converts a string to date

17. Day - Returns the day of the month of a date

18. Dir - Returns the name of a file or directory that matches a pattern

19. DoEvents - Yields execution so the operating system can process other events

20. EOF - Returns True if the end of a text file has been reached

21. Error - Returns the error message that corresponds to an error number

22. Exp - Returns the base of the natural logarithms (e) raised to a power

23. InputBox - Displays a box to prompt a user for input, and returns the value entered

24. InStr - Returns the position of a string within another string

25. InStrRev - Returns the position of a string within another string, beginning at the back end of 
the string

26. Int - Returns the integer portion of a number

27. IsArray - Returns True if a variable is an array

28. IsDate - Returns True if a variable is a date

29. IsEmpty - Returns True if a variable has not been initialized

30. IsError - Returns True if an expression is an error value

31. IsMissing - Returns True if an optional argument was not passed to a Procedure

32. IsNull - Returns True if an expression contains no valid data

33. IsNumeric - Returns True if an expression can be evaluated as a number

34. IsObject - Returns True if an expression references an OLE Automation object

35. Join - Returns a string created by joining a number of substrings contained in an array

36. MonthName - Returns a string indicating the specified month

37. MsgBox - Displays a modal message box and returns the ID of the button clicked

38. Now - Returns the current system date and time

39. Oct - Converts from decimal to octal

40. Replace - Returns a string in which one substring is replaced with another

41. RGB - Returns a number representing an RGB color value

42. Right - Returns a specified number of characters from the right of a string

43. Rnd - Returns a random number between 0 and 1

44. Round - Rounds a number to a specific number of decimal places

45. RTrim - Returns a copy of a string with no trailing spaces

46. Second - Returns the second of a time

47. Seek - Returns the current position in a text file

48. Sgn - Returns an integer that indicates the sign of a number

49. Shell - Runs an executable program

50. Sin - Returns the sine of a number

51. Tab - Positions output in an output stream

52. Tan - Returns the tangent of a number

53. Time - Returns the current system time

54. Timer  - Returns the number of seconds since midnight

55. TimeSerial  - Returns the time for a specified hour, minute, and second

56. TimeValue  - Converts a string to a time serial number

57. Trim - Returns a string without leading and spaces and replaces multiple spaces with a single space

58. TypeName  - Returns a string that describes the data type of a variable

59. UBound - Returns the upper bound of an array

60. UCase - Converts a string to uppercase

61. Val - Returns the numbers contained in a string

62. VarType - Returns a value indicating the subtype of a variable

63. Weekday - Returns a number representing a day of the week

64. Abs - Returns the absolute value of a number

65. Array - Returns a variant that contains an array

66. Asc - Converts the first character of string to its ASCII value

67. Atn - Returns the arctangent of a number

68. CBool - Converts an expression to Boolean data type

69. CByte - Converts an expression to byte data type

70. CreateObject - Creates an OLE Automation object

71. CSng - Converts an expression to single data type

72. CStr - Converts an expression to string data type

73. CurDir - Returns the current path

74. CVar - Converts an expression to variant data type

75. CVDate - Converts an expression to date data type

76. FileAttr - Returns the file mode for a text file

77. FileDateTime - Returns the date and time when a file was last modified

78. FileLen - Returns the number of bytes in a file

79. Fix - Returns the integer portion of a number

80. Format - Returns an expression in a particular format

81. FormatCurrency - Returns a number as a string, formatted as currency

82. FormatDateTime - Returns a number as a string, formatted as a date and/or time

83. FormatNumber - Returns a number as a formatted string

84. FormatPercent - Returns a number as a string, formatted as a percentage

85. FreeFile - Returns the next file number available for use by the Open statement

86. GetAll - Returns a list of key settings and their values (originally created with SaveSetting) from an application’s entry in the Windows registry

87. GetAttr - Returns a code representing a file attribute

88. GetObject - Retrieves an OLE Automation object from a file

89. GetSetting  - Returns a key setting value from an application’s entry in the Windows registry

90. LBound - Returns the lower bound of an array

91. LCase - Returns a string converted to lowercase

92. Left - Returns a specified number of characters from the left of a string

93. Len - Returns the length of a string, in characters

94. Loc - Returns the current read or write position of a text file

95. LOF - Returns the number of bytes in an open text file

96. Log - Returns the natural logarithm of a number

97. LTrim - Returns a copy of a string with no leading spaces

98. Mid - Returns a specified number of characters from a string

99. Space  - Returns a string with a specified number of spaces

100. Split  - Returns an array consisting of a number of substrings

101. Sqr - Returns the square root of a number

102. Str - Returns a string representation of a number

103. StrComp - Returns a value indicating the result of a string comparison

104. StrConv - Returns a string variant converted as specified

105. String - Returns a repeating character or string

106. StrReverse - Returns the characters of a string in reverse order

107. Switch - Evaluates a list of expressions and returns a value associated with the first expression in the list that is True

108. Weekday Name - Returns a string indicating the specified weekday

109. Year  - Returns the year of a date

110. MidB - Returns a specified number of bytes from a specified position in a string string

111. Minute - Returns the minute of a time

112. Month - Returns the month of a date

113. Hex - Converts from decimal to hexadecimal

114. Hour - Returns the hour of a time

115. IIf - Returns one of two parts, depending on the evaluation of an expression

116. Input - Returns a specific number of characters from an open text file

No comments:

Post a Comment