Skip to main content
Visual Basic Using Macro In Excel
USE OF MACRO IN MS EXCEL
RIGHT CLICK ON EXCEL SHEET TAB=VIEW CODE AND TYPE GIVEN BELOW
Sub Uppercase()
' Loop to cycle through each cell in the specified range.
For Each x In Range("A1:A5")
' Change the text in the range to uppercase letters.
x.Value = UCase(x.value)
Next
End Sub
RUN MACRO (ALT-F8)
Sub Lowercase()
' Loop to cycle through each cell in the specified range.
For Each x In Range("B1:B5")
x.Value = LCase(x.Value)
Next
End Sub
Sub Proper_Case()
' Loop to cycle through each cell in the specified range.
For Each x In Range("C1:C5")
' There is not a Proper function in Visual Basic for Applications.
' So, you must use the worksheet function in the following form:
x.Value = Application.Proper(x.Value)
Next
End Sub

Comments
Post a Comment