简体   繁体   中英

VBA: Range Syntax Confusion

What is the difference between

Range("A1","A40").Select 
Range("A1:A40").Select

Though both of them produce the same result. I would like to know the difference between them

There's no difference. It is only a form of easiness in vBA language that let you assign or call the same objects' properties or methods in many different ways.

You can also select the same range with the following syntax

Range(Cells(1, 1), Cells(1, 40))

While I might understand your confusion if you have practiced other "strict" programming languages, this should not disturb you. Just view this as more flexibility provided by vba language and syntax

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM