Sub Trim(sh,FirstCell,LastCell)
Sheets(sh).select
Range(FirstCell,LastCell) = [index(Upper(FirstCell,LastCell),)]
End Sub
I want to do something like this to make it dynamic. Calling this macro through other application where I'm giving input for sheet name first cell and last cell of the range.
One cannot use
[]
with variables it expects a string. Also ranges already have the Sheet in the variable and adding it is not needed:Or use UCase: