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

David Goins 1 Reputation point
2020-05-17T00:01:43.61+00:00

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.
36,152 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Fay Wang - MSFT 5,196 Reputation points
    2020-05-22T03:13:09.737+00:00

    Hello,

    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.

    Thanks.

    0 comments No comments