Sub Sample() [A1:A20] = [INDEX(UPPER(A1:A20),)] End Sub
Hi, For the above code that was provided by Siddharth Rout, is it possible to change the 20 to a variable such as last row in a worksheet?
Many thanks in advance.
Sub UpperCase() Dim TargetRng As Range, LastRow As Long LastRow = Sheet1.Range("A" & Rows.Count).End(xlUp).Row Set TargetRng = Sheet1.Range("A1:A" & LastRow) TargetRng = Evaluate("INDEX(UPPER(" & TargetRng.Address & "),)") End Sub
 is just shorthand for
Evaluate. Using the whole word has no penalties and can be used with VBA as well. Just tried it and it works.
Let us know if this helps.
The only way would be to put the largest amount of rows possible. For Excel 2007 would be 1048576