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 quot;Iquot; quot;Jquot; amp; quot;Kquot; (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 quot;Paste
Specialquot; with and quot;Add Operationquot; 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.PLEASE do not multipost
--
Don Guillett
SalesAid Software
quot;Sam Hillquot; gt; wrote in message
...
gt; Greetings,
gt; I am stumped so I am hoping the experts can help. I have spent many
gt; hours trying to write code to accomplish a certain task and no matter
gt; how I tweak it I keep running into problems. I will attempt to
gt; explain my goal:
gt;
gt; I have a worksheet that contains two columns of numbers (with no empty
gt; cells in the columns) that need to be compared. It will not always be
gt; the same two columns, so I need to be able to input which two before
gt; the program runs. The number of rows will also vary.
gt;
gt; For the sake of simplicity let's call these columns dataOld and
gt; dataNew. First I need to search through dataOld and if a number is
gt; found that is *not* contained in dataNew, the cell containing the
gt; dataOld number as well as the two cells to the right need to be moved
gt; into columns quot;Iquot; quot;Jquot; amp; quot;Kquot; (starting at row # 1). And each time cells
gt; are added to IJK, they need to be placed in the row under the
gt; previously-added cells.
gt;
gt; Now I need to take the remaining cells in dataOld and move each cell
gt; (and the two cells to the right) into the same row that contains the
gt; matching number in dataNew, keeping to the same columns. (In some
gt; rows this criteria will already be met, with the matching dataOld and
gt; dataNew cells already in the same row).
gt;
gt; This should then leave three blank cells (the cell in dataOld and the
gt; two cells to the right) in the same row as dataNew if there was not a
gt; match in dataOld.
gt;
gt; Columns IJK now need to be adjusted to the width of the data they
gt; contain.
gt;
gt; Error handling should be added for two scenarios: Either the user
gt; inputs an incorrect column (in which case there would be no matches
gt; between dataOld and dataNew), or the user inputs an invalid column
gt; (such as inputting a number).
gt;
gt; There is one additional problem that I need to mention: Columns
gt; dataOld and dataNew always have errors in some of the cells (causing
gt; the little green triangle to appear in the upper left of the cell).
gt; My fix for this has been to copy from an empty cell, then do a quot;Paste
gt; Specialquot; with and quot;Add Operationquot; to the entire sheet. This works,
gt; but takes some time to run, and I would like to know of any more
gt; efficient ways to handle this.
gt;
gt; I hope I have done a sufficient job of explaining what I need. I
gt; won't embarrass myself by posting any of my code attempts, although
gt; this might give some of you a nice chuckle.
gt;
gt; Thanks in advance for any help.
gt;
gt; S. H.
gt;
- Nov 18 Sat 2006 20:10
Help with VBA code please
close
全站熱搜
留言列表
發表留言