Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default problems with .EntireRow function

Anyone come across this before. This code has worked fine in the past, but I
have one particular sheet which behaves very strangely.
I have

Dim ThisRow as Range

and am working down one sheet, collecting data, and moving some parts to
another. (src - source, dest - destination)

The 'business' line is:

Set ThisRow = wsSrc.Range("A" & nDRow).EntireRow '{nDrow is my data row}

then

wsDest.Range("AG" & nDRow) = ThisRow.Range("AB" & nDRow).Value

should take the value from wssrc cell AB5 and put it into wsDest cell AG5.

What it actually does is take the data from cell AB9
When nDrow is 6, my data should come from AB6, but it actually comes from
AB11, and when ndrow is 7, my destination data comes from row 13. - In each
case from the correct column.

Any idea what is going on here? I'd have though this ought to be impossible.
The only reason I've found it was that my data integrity check reported a
problem, and I could find nothing wrong with the orginal row (6339). I
spotted that the name wasn't right, and finally found the duff source data in
row 12667.

As far as I can tell, this only happens with one of my source sheets, but my
confidence is a bit shaken!!!

Any thoughts appreciated.






  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default problems with .EntireRow function

It is because, once you have calculated the entirerow you then offset it
again using nDRow. You only want to offset ThisRow to AB, not by more rows
as in nDRow as well.

You should use

wsDest.Range("AG" & nDRow) = ThisRow.Range("AB1").Value

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"DavidAtCaspian" wrote in message
...
Anyone come across this before. This code has worked fine in the past, but

I
have one particular sheet which behaves very strangely.
I have

Dim ThisRow as Range

and am working down one sheet, collecting data, and moving some parts to
another. (src - source, dest - destination)

The 'business' line is:

Set ThisRow = wsSrc.Range("A" & nDRow).EntireRow '{nDrow is my data

row}

then

wsDest.Range("AG" & nDRow) = ThisRow.Range("AB" & nDRow).Value

should take the value from wssrc cell AB5 and put it into wsDest cell AG5.

What it actually does is take the data from cell AB9
When nDrow is 6, my data should come from AB6, but it actually comes from
AB11, and when ndrow is 7, my destination data comes from row 13. - In

each
case from the correct column.

Any idea what is going on here? I'd have though this ought to be

impossible.
The only reason I've found it was that my data integrity check reported a
problem, and I could find nothing wrong with the orginal row (6339). I
spotted that the name wasn't right, and finally found the duff source data

in
row 12667.

As far as I can tell, this only happens with one of my source sheets, but

my
confidence is a bit shaken!!!

Any thoughts appreciated.








  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default problems with .EntireRow function

Thanks Bob.

I re-read the explanations of range, and think I have it now.
The reason all the other sheets are OK, is that this is the only one that
needs transposition.

So all the others have the value of the entire row copied in, and in the
problem sheet the work lines now look like this:

wsDest.Range("AG" & nDRow) = ThisRow.Range("AB1").Value


Thanks for the help.

David





If nDrow is 7----
I get exactly the same problem. ThisRow.range(AB7) is actually populated
from the original sheet row 9.

In any case, since ThisRow should just be a single row. and certainly
Rows(nDrow) should be a single row, then either both the
Rows and EntireRow function are taking the wrong row, or are taking more
than one row, and then working from the back!)





"Bob Phillips" wrote:




It is because, once you have calculated the entirerow you then offset it
again using nDRow. You only want to offset ThisRow to AB, not by more rows
as in nDRow as well.

You should use

wsDest.Range("AG" & nDRow) = ThisRow.Range("AB1").Value

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"DavidAtCaspian" wrote in message
...
Anyone come across this before. This code has worked fine in the past, but

I
have one particular sheet which behaves very strangely.
I have

Dim ThisRow as Range

and am working down one sheet, collecting data, and moving some parts to
another. (src - source, dest - destination)

The 'business' line is:

Set ThisRow = wsSrc.Range("A" & nDRow).EntireRow '{nDrow is my data

row}

then

wsDest.Range("AG" & nDRow) = ThisRow.Range("AB" & nDRow).Value

should take the value from wssrc cell AB5 and put it into wsDest cell AG5.

What it actually does is take the data from cell AB9
When nDrow is 6, my data should come from AB6, but it actually comes from
AB11, and when ndrow is 7, my destination data comes from row 13. - In

each
case from the correct column.

Any idea what is going on here? I'd have though this ought to be

impossible.
The only reason I've found it was that my data integrity check reported a
problem, and I could find nothing wrong with the orginal row (6339). I
spotted that the name wasn't right, and finally found the duff source data

in
row 12667.

As far as I can tell, this only happens with one of my source sheets, but

my
confidence is a bit shaken!!!

Any thoughts appreciated.









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
Need Help with ActiveCell.EntireRow.Delete Ayo Excel Discussion (Misc queries) 8 July 19th 08 04:45 PM
EntireRow.Delete, Causes Problems In ComboBox In Another Workbook Raleigh Excel Programming 3 January 11th 06 07:21 PM
How to fix cell.entirerow.delete? guy Excel Programming 1 March 10th 05 02:31 AM
EntireRow.Delete Steph[_3_] Excel Programming 14 January 21st 05 10:31 PM
EntireRow.Hidden Jonas Haettner Excel Programming 1 October 24th 03 09:19 AM


All times are GMT +1. The time now is 12:10 PM.

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"