Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 252
Default range.offset(0,1) is OK but range.offset(0,2) not

Hi all,

I have four merged blocks in a row on a worksheet as follow:

BCDE FGH IJ K-T

I set rng to the first block's range whose addressi B1 then
I use rng.offset(0,1) to jump to the second block and I did it, but when I
want to continue with rng.offset(0,2) and rng.offset(0,3) , they did not jump
to third and fourth block, but to cell G1 and H1. I think I can reset the
starting range and use one rng.offset(0,1). Is there other hack way?


Clara
--
thank you so much for your help
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default range.offset(0,1) is OK but range.offset(0,2) not

Clara,

Use successive offsets:

Dim rng As Range
Set rng = Range("B1")
MsgBox rng.Address
Set rng = rng.Offset(0, 1)
MsgBox rng.Address
Set rng = rng.Offset(0, 1)
MsgBox rng.Address
Set rng = rng.Offset(0, 1)
MsgBox rng.Address

OR

rng.Offset(0, 1).Offset(0, 1)

rng.Offset(0, 1).Offset(0, 1).Offset(0, 1)

--
HTH,
Bernie
MS Excel MVP


"clara" wrote in message
...
Hi all,

I have four merged blocks in a row on a worksheet as follow:

BCDE FGH IJ K-T

I set rng to the first block's range whose addressi B1 then
I use rng.offset(0,1) to jump to the second block and I did it, but when I
want to continue with rng.offset(0,2) and rng.offset(0,3) , they did not jump
to third and fourth block, but to cell G1 and H1. I think I can reset the
starting range and use one rng.offset(0,1). Is there other hack way?


Clara
--
thank you so much for your help



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy range using offset range value caroline Excel Programming 2 February 16th 06 02:51 PM
For Each offset range Michael Smith Excel Programming 2 September 14th 05 07:41 PM
Problem with Range.Cells.Offset and Range.Cells( row + offset, column) [email protected] Excel Programming 2 August 22nd 05 05:25 AM
Offset Range hotherps[_113_] Excel Programming 11 August 20th 04 12:38 AM
range offset Douvid Excel Programming 5 August 20th 03 04:38 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"