ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Can I abbrevate the following (would I Dim and Set it as a Range?) (https://www.excelbanter.com/excel-programming/415795-can-i-abbrevate-following-would-i-dim-set-range.html)

Simon[_2_]

Can I abbrevate the following (would I Dim and Set it as a Range?)
 
AccRep.Sheets("Volumes").Cells.Find("latest")

Rather than using this many times in the code I thought I could define
it as a Rng or Path or String or something?

Which would I use, whats the different between a Path and a String.

Thanks VBA (virtually beginner amateur)

stefan onken

Can I abbrevate the following (would I Dim and Set it as aRange?)
 
hi, you can use Set to set a reference, e.g.

Dim rng as Range
Set rng = AccRep.Sheets("Volumes").Cells.find()
rng.offset(0,1)=1
rng.Offset(0,2)=2

rng must be a Range, a String won`t work.

stefan


On 18 Aug., 12:18, Simon wrote:
AccRep.Sheets("Volumes").Cells.Find("latest")

Rather than using this many times in the code I thought I could define
it as a Rng or Path or String or something?

Which would I use, whats the different between a Path and a String.

Thanks VBA (virtually beginner amateur)




All times are GMT +1. The time now is 07:01 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com