How do I use strings in to define a range in a SetRange Range() statement?

David Goins 1 Reputation point

An example that DOES work is:
Range("BA"&xrow).Offset(0,counter-1).value=xsav were xrow is a row number converted to a string

The following DOES NOT work:
I want to sort a column of numbers, say AB51519:AB52150
I have a string variable defined for 51519 (str1) and a string variable defined for 52150 (str2)
I get a error when I try to .SetRange Range("AB"&str1:"AB"&str2)
I have tried many combinations of syntax to obtain an acceptable statement, but so far, am unable to do so.
The bottom line is, how do I use sting variables to specify a range in a .SetRange Range () statement?
I have over 68,000 of these sorts to do, so I MUST have some process for automating this function.
Your help would be much appreciated.

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
37,738 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Fay Wang - MSFT 5,206 Reputation points


    Welcome to Microsoft Q&A!

    Your issue about Office is not supported right now. But you could go to this forum to ask this question.


    0 comments No comments