Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Need help using VBA to compare data in Excel columns, then manipulating data

Greetings,
I am stumped so I am hoping the experts can help. I have spent many
hours trying to write code to accomplish a certain task and no matter
how I tweak it I keep running into problems. I will attempt to
explain my goal:

I have a worksheet that contains two columns of numbers (with no empty
cells in the columns) that need to be compared. It will not always be
the same two columns, so I need to be able to input which two before
the program runs. The number of rows will also vary.

For the sake of simplicity let's call these columns dataOld and
dataNew. First I need to search through dataOld and if a number is
found that is *not* contained in dataNew, the cell containing the
dataOld number as well as the two cells to the right need to be moved
into columns "I" "J" & "K" (starting at row # 1). And each time cells
are added to IJK, they need to be placed in the row under the
previously-added cells.

Now I need to take the remaining cells in dataOld and move each cell
(and the two cells to the right) into the same row that contains the
matching number in dataNew, keeping to the same columns. (In some
rows this criteria will already be met, with the matching dataOld and
dataNew cells already in the same row).

This should then leave three blank cells (the cell in dataOld and the
two cells to the right) in the same row as dataNew if there was not a
match in dataOld.

Columns IJK now need to be adjusted to the width of the data they
contain.

Error handling should be added for two scenarios: Either the user
inputs an incorrect column (in which case there would be no matches
between dataOld and dataNew), or the user inputs an invalid column
(such as inputting a number).

There is one additional problem that I need to mention: Columns
dataOld and dataNew always have errors in some of the cells (causing
the little green triangle to appear in the upper left of the cell).
My fix for this has been to copy from an empty cell, then do a "Paste
Special" with and "Add Operation" to the entire sheet. This works,
but takes some time to run, and I would like to know of any more
efficient ways to handle this.

I hope I have done a sufficient job of explaining what I need. I
won't embarrass myself by posting any of my code attempts, although
this might give some of you a nice chuckle.

Thanks in advance for any help.

S. H.

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
Help with manipulating data in excel? jock Excel Discussion (Misc queries) 3 July 29th 08 03:24 PM
Transposing three columns into one row after manipulating data in columns digitaldon Excel Discussion (Misc queries) 1 November 20th 06 11:35 PM
Excel Formula or tool to compare two columns of data RBS Excel Worksheet Functions 3 April 14th 06 06:54 PM
Training on Manipulating Data in Excel Rufus Excel Discussion (Misc queries) 1 October 18th 05 05:07 AM
Compare Two Columns of Data Using VB Excel willik[_7_] Excel Programming 2 March 1st 04 02:16 PM


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