question

DavidGoins-9045 avatar image
DavidGoins-9045 asked ·

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

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-supported
1 comment
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Are you operating on the content of the Word, Excel or other Office365 apps?

0 Votes 0 · ·

1 Answer

FayWang-MSFT avatar image
FayWang-MSFT answered ·

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.


Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.