Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default Offset not working

On a single worksheet I have a table with the top row is named myRange1.
Farther down the sheet, I have another table which is made up of data
extracted from the upper table. This table top row is names myRange2

This code does the extraction:
Row = 4
For Each tcell in Range("myRange1")
For Each cell in Range("myRange2")
If cell.Value = tcell.Value Then
tcell.Offset(Row,0).Value = cell.Offset(7,0).value
tcell.Offset(Row,2).Value = Name
End If
Next cell
Next tcell

When I run this code, nothing is written in cells tcell.Offset(Row,0).Value
and tcell.Offset(Row,2).Value. When watch in Debugger, it looks like there
are values present.

What is happening?

Thanks in advance for your help!

Ray


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

You don't ever show Name being assigned a value.

for not writing values, possibilities a
cell.Value never equals tcell.value ?
cell.offset(7,0).Value is empty
you don't realize offset is zero based and your looking at the wrong
location.

Other than that, it should perform as written (which may not be as
expected).

--
Regards,
Tom Ogilvy

Ray Batig wrote in message
hlink.net...
On a single worksheet I have a table with the top row is named myRange1.
Farther down the sheet, I have another table which is made up of data
extracted from the upper table. This table top row is names myRange2

This code does the extraction:
Row = 4
For Each tcell in Range("myRange1")
For Each cell in Range("myRange2")
If cell.Value = tcell.Value Then
tcell.Offset(Row,0).Value = cell.Offset(7,0).value
tcell.Offset(Row,2).Value = Name
End If
Next cell
Next tcell

When I run this code, nothing is written in cells

tcell.Offset(Row,0).Value
and tcell.Offset(Row,2).Value. When watch in Debugger, it looks like there
are values present.

What is happening?

Thanks in advance for your help!

Ray




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default Offset not working

Thanks Tom,

I figured out that I was really supplying the Row value to the row offset
variable. I found this by assigning "here" to Name, running the code and
then searching the worksheet for here.

I guess I an a little worn out.

Regards,
Ray

Tom Ogilvy wrote in message
...
You don't ever show Name being assigned a value.

for not writing values, possibilities a
cell.Value never equals tcell.value ?
cell.offset(7,0).Value is empty
you don't realize offset is zero based and your looking at the wrong
location.

Other than that, it should perform as written (which may not be as
expected).

--
Regards,
Tom Ogilvy

Ray Batig wrote in message
hlink.net...
On a single worksheet I have a table with the top row is named myRange1.
Farther down the sheet, I have another table which is made up of data
extracted from the upper table. This table top row is names myRange2

This code does the extraction:
Row = 4
For Each tcell in Range("myRange1")
For Each cell in Range("myRange2")
If cell.Value = tcell.Value Then
tcell.Offset(Row,0).Value = cell.Offset(7,0).value
tcell.Offset(Row,2).Value = Name
End If
Next cell
Next tcell

When I run this code, nothing is written in cells

tcell.Offset(Row,0).Value
and tcell.Offset(Row,2).Value. When watch in Debugger, it looks like

there
are values present.

What is happening?

Thanks in advance for your help!

Ray






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
Offset function not working correctly Flipper Excel Discussion (Misc queries) 1 August 19th 09 06:45 PM
Dynamic Chart with OFFSET defined name not working Montse Charts and Charting in Excel 2 April 1st 09 01:35 PM
OFFSET equation not working Raz Excel Worksheet Functions 3 March 2nd 09 06:07 PM
OFFSET() not working within a SUMPRODUCT() when refering to a range in a pivot table Conan Kelly Excel Worksheet Functions 6 April 11th 07 12:32 AM
offset not working BorisS Excel Discussion (Misc queries) 2 November 30th 05 08:15 AM


All times are GMT +1. The time now is 07:04 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"