Selecting/copying a dynamic range in VB
Hello,
this might be a fairly simple question, but if somebody could help out I would greatly appreciate it. So, my problem is that I want to copy a ceratin range from a worksheet. However, this range is dynamic and depends on three values: 1. The "coordinates" of the data, i.e. the location of the top-left cell 2. The width of the table/selection 3. The lenght of the table/selection If I have these values in cells A1, A2, A3, A4. How do I code the selection into VB? .Range( ??? ) Moreover, how do I use OFFSET in this kind of range selection situation? BR, Josip |
Selecting/copying a dynamic range in VB
Assuming A1 has the row number, A2 has the column number, A3 has the number
of rows deep and A4 has the number of column wide... Set R = Cells(Range("A1"), Range("A2")).Resize(Range("A3"), Range("A4")) where R is Dim'med as a Range. After doing this, R will be a real range that you can do whatever you want to, including Offset'ting from if desired. -- Rick (MVP - Excel) "Josip" wrote in message ... Hello, this might be a fairly simple question, but if somebody could help out I would greatly appreciate it. So, my problem is that I want to copy a ceratin range from a worksheet. However, this range is dynamic and depends on three values: 1. The "coordinates" of the data, i.e. the location of the top-left cell 2. The width of the table/selection 3. The lenght of the table/selection If I have these values in cells A1, A2, A3, A4. How do I code the selection into VB? .Range( ??? ) Moreover, how do I use OFFSET in this kind of range selection situation? BR, Josip |
All times are GMT +1. The time now is 08:08 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com