Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 683
Default How to compare to fields and move data?

I have 2 spread sheets in a workbook, one of which is updated as a weekly
imported report. The updated report is a copy of my master. The data on the
update can be changed/corrected and is resubmitted each week with all
previous changes included. I need to add the newest data to my master page
w/o having to review each line (1000+) I have a date field but that doesn't
relate to when change was made.
My Psuedo code looks like this:
Compare sheet1 row1 col.T to sheet 2 row 1 col.S
If not equal then copy sheet 2 row1 col.g thru n to sheet1 row 1 col h thru
o and put "new" in sheet1 row1 col.a
if T equals S then next row
do till end of file.

I have the compare working in a function but I read in another thread that
you can't move data in a function so here I am. Any help would be greatly
appreciated.

thx
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 983
Default How to compare to fields and move data?

There is absolutely nothing stopping you from moving data withing a function.
In VB it is however considered to be bad form. Moving data would normally be
called a side effect (which generally you don't want.) For example every
formula you use in Excel is a function. But there is no formula that allows
you to physically move data from one cell to another.

As a complete aside C programming languages don't even have Sub Procedures.
Everything is a function, so you have to use Functions to move or change data.

That having been said. I would use two range objects to handle the problem
you have. Set one Range object to Cell A1 on one sheet. Set the other Range
Object to Cell A1 on the other sheet and then move them around comparing the
results. Wherever the reustlts are not equal, Copy the entire row of the
first range object to the entire row of the second range object.

If you need help implementing that just reply back and I can get you
started...

HTH



"Brian" wrote:

I have 2 spread sheets in a workbook, one of which is updated as a weekly
imported report. The updated report is a copy of my master. The data on the
update can be changed/corrected and is resubmitted each week with all
previous changes included. I need to add the newest data to my master page
w/o having to review each line (1000+) I have a date field but that doesn't
relate to when change was made.
My Psuedo code looks like this:
Compare sheet1 row1 col.T to sheet 2 row 1 col.S
If not equal then copy sheet 2 row1 col.g thru n to sheet1 row 1 col h thru
o and put "new" in sheet1 row1 col.a
if T equals S then next row
do till end of file.

I have the compare working in a function but I read in another thread that
you can't move data in a function so here I am. Any help would be greatly
appreciated.

thx

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 683
Default How to compare to fields and move data?

Ok Jim, If you think it would be simpler to just move the entire row. I have
the columns locked from b-h on both sheets to prevent someone from messin up
the main data. I just thought that it might be easier to move the input data
instead of the whole row. Anyway, If you could give me a nudge on some code
references ( selecting rows adn such) I do have a little experience with c++
and I have a VB6 book for ref.
Thank for the fast reply. :)

"Jim Thomlinson" wrote:

There is absolutely nothing stopping you from moving data withing a function.
In VB it is however considered to be bad form. Moving data would normally be
called a side effect (which generally you don't want.) For example every
formula you use in Excel is a function. But there is no formula that allows
you to physically move data from one cell to another.

As a complete aside C programming languages don't even have Sub Procedures.
Everything is a function, so you have to use Functions to move or change data.

That having been said. I would use two range objects to handle the problem
you have. Set one Range object to Cell A1 on one sheet. Set the other Range
Object to Cell A1 on the other sheet and then move them around comparing the
results. Wherever the reustlts are not equal, Copy the entire row of the
first range object to the entire row of the second range object.

If you need help implementing that just reply back and I can get you
started...

HTH



"Brian" wrote:

I have 2 spread sheets in a workbook, one of which is updated as a weekly
imported report. The updated report is a copy of my master. The data on the
update can be changed/corrected and is resubmitted each week with all
previous changes included. I need to add the newest data to my master page
w/o having to review each line (1000+) I have a date field but that doesn't
relate to when change was made.
My Psuedo code looks like this:
Compare sheet1 row1 col.T to sheet 2 row 1 col.S
If not equal then copy sheet 2 row1 col.g thru n to sheet1 row 1 col h thru
o and put "new" in sheet1 row1 col.a
if T equals S then next row
do till end of file.

I have the compare working in a function but I read in another thread that
you can't move data in a function so here I am. Any help would be greatly
appreciated.

thx

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
Set up form fields to that Tab can be used to move from one to ano Mica Excel Discussion (Misc queries) 0 February 10th 10 10:11 PM
Compare data in three fields tssgraham Excel Discussion (Misc queries) 5 June 8th 07 09:57 PM
Pivot Table - Compare 2 fields? Erin Excel Discussion (Misc queries) 0 June 1st 06 08:28 PM
How do i compare data fields and assign values? BmxMom101 Excel Worksheet Functions 0 November 10th 05 03:43 PM
Arrays: compare fields? NorTor[_4_] Excel Programming 1 February 17th 05 10:29 AM


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