Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Sam Hill
 
Posts: n/a
Default VBA code help please

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
code not unique find latest date Barbara Wiseman Excel Discussion (Misc queries) 3 December 11th 05 08:50 AM
VLOOKUP for Zip Code Ranges JerseyJR Excel Worksheet Functions 2 September 6th 05 06:37 PM
Conform a total to a list of results? xmaveric Excel Discussion (Misc queries) 1 August 21st 05 07:22 PM
Macro for changing text to Proper Case JPriest Excel Worksheet Functions 3 August 8th 05 09:31 PM
close form code tkaplan Excel Discussion (Misc queries) 1 June 3rd 05 10:49 PM


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

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"