문제

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.

도움이 되었습니까?

해결책

Try this:

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top