#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Offset


Hi,

I am trying to use offset to traverse through a worksheet in which
there are five nonhidden columns and a bunch of hidden columns in
between. I have a range variable that stores the location of the first
column and first row (there are different titles and such at the top so
its not actually row 1). I thought that range = range.Offset(0,1) would
set the range to the location of the column to the immediate right of
the data, but for some reason it starts skipping columns. Why does it
do that? Thanks in advance.


--
Raman325
------------------------------------------------------------------------
Raman325's Profile: http://www.excelforum.com/member.php...o&userid=24748
View this thread: http://www.excelforum.com/showthread...hreadid=396202

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Offset

It does refer to the column to the immediate right.

for example

cells(i,j).offset(0,1)

would refer to

cells(i,j+1)

Perhaps you can just use

cells(i,j+1)

--
Regards,
Tom Ogilvy


"Raman325" wrote in
message ...

Hi,

I am trying to use offset to traverse through a worksheet in which
there are five nonhidden columns and a bunch of hidden columns in
between. I have a range variable that stores the location of the first
column and first row (there are different titles and such at the top so
its not actually row 1). I thought that range = range.Offset(0,1) would
set the range to the location of the column to the immediate right of
the data, but for some reason it starts skipping columns. Why does it
do that? Thanks in advance.


--
Raman325
------------------------------------------------------------------------
Raman325's Profile:

http://www.excelforum.com/member.php...o&userid=24748
View this thread: http://www.excelforum.com/showthread...hreadid=396202



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default Offset

Assuming your range variable is an actual range object such as
dim rng as range

then you can move the range object like this

set rng = rng.offset(0,1)

P.S. don't declare the range object as
dim Range as Range
Since range is a reserved word...
--
HTH...

Jim Thomlinson


"Raman325" wrote:


Hi,

I am trying to use offset to traverse through a worksheet in which
there are five nonhidden columns and a bunch of hidden columns in
between. I have a range variable that stores the location of the first
column and first row (there are different titles and such at the top so
its not actually row 1). I thought that range = range.Offset(0,1) would
set the range to the location of the column to the immediate right of
the data, but for some reason it starts skipping columns. Why does it
do that? Thanks in advance.


--
Raman325
------------------------------------------------------------------------
Raman325's Profile: http://www.excelforum.com/member.php...o&userid=24748
View this thread: http://www.excelforum.com/showthread...hreadid=396202


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Offset


Thanks for the responses. Yeah, I haven't been using range as the
variable name, I just used that as the example. That is exactly how I
had my macro set up, but it is still not going through the worksheet
correctly. I was playing around with the worksheet, moving left and
right with the arrow keys, and for some reason, its skipping over
columns. Why is it doing that? The right and left arrows arent working
as they should and I suspect that's what is causing the problem with
the offset.


--
Raman325
------------------------------------------------------------------------
Raman325's Profile: http://www.excelforum.com/member.php...o&userid=24748
View this thread: http://www.excelforum.com/showthread...hreadid=396202

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Offset

No, right and left arrows do skip hidden columns, but this isn't the case
with offset.

? ActiveCell.Offset(0,1).EntireColumn.Hidden
True


--
Regards,
Tom Ogilvy

"Raman325" wrote in
message ...

Thanks for the responses. Yeah, I haven't been using range as the
variable name, I just used that as the example. That is exactly how I
had my macro set up, but it is still not going through the worksheet
correctly. I was playing around with the worksheet, moving left and
right with the arrow keys, and for some reason, its skipping over
columns. Why is it doing that? The right and left arrows arent working
as they should and I suspect that's what is causing the problem with
the offset.


--
Raman325
------------------------------------------------------------------------
Raman325's Profile:

http://www.excelforum.com/member.php...o&userid=24748
View this thread: http://www.excelforum.com/showthread...hreadid=396202





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
Compare Cell Values, Offset(-1,0), Offset(-1,-1), and xlFillDefaul RyGuy Excel Worksheet Functions 2 September 28th 07 10:54 PM
Offset help comotoman Excel Discussion (Misc queries) 1 December 21st 05 06:17 PM
Max Offset Voodoodan Excel Discussion (Misc queries) 19 May 26th 05 11:47 AM
Offset Between? hotherps[_133_] Excel Programming 2 August 27th 04 05:35 PM
OFFSET and UDF bug Charles Williams Excel Programming 2 July 30th 03 09:02 AM


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

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

About Us

"It's about Microsoft Excel"