Friday, July 15, 2011

Excel macro for uppercase conversion


Here is an excel macro for convert to uppercase the text contained in the current cell or a selected range.

Sub Uppercase()
RowsCount = Selection.Rows.Count
ColumnsCount = Selection.Columns.Count
if RowsCount = 0 or ColumnsCount=0 then
   MsgBox "ERROR: Please select a range or cell"
else

 Set Area = Selection
 For Each Cell In Area
  
' Change to uppercase.    Cell.Value = UCase(Cell.value)
 Next Cell

end if End Sub