Re: Excel VBA Algorithm

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



First, thank you for your response.
I have posted the three examples to show how the numbers will change. If
you input in number 9 in number 5 cell, yes 5 will be replaced by the number
9, then after number 9, there will be 5,6,7,8,10.
In regard to 30, I will have validation code to not accept any number above
number 30.
Thank you,
Rad


"Rick Rothstein" wrote:

Well, you made the task even more challenging by not giving us a clue as to
how you want any duplicates removed... the simplest would be to trade the
number being overwritten for the number the user is typing in... would that
be acceptable or did you have some other way in mind? Also... what cells are
your numbers in (or what cells are they allowed to be in? Do you have any
controls to prevent the user from typing in more than 30 numbers in your
column (that would create an impossible situation to handle other than
removing the entry immediately)? Do you have any control to stop the user
from typing in a number bigger than 30?

--
Rick (MVP - Excel)


"Rad" <Rad@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:0E9CECE7-D297-4C55-A064-7D06316149DD@xxxxxxxxxxxxxxxx
Hi,

I am looking for an advice on this challenging algorithm.

I have a column in ms excel sheet and has the numbers from 1 – 30, and I
need to use vba code to allow the user to be able to change a number at a
time. Then as soon as it is changed, the column numbers need the change
so
there is no duplicate numbers in the column. In other words, the column
numbers 1- 30 must have only a number of each.

Any advice will be appreciated.

Thank you,
Rad





I thought about swapping, but the number next to the changed number must
be
reduced by a number until the number that has been changed from is
reached.

For example:
Original Changed Changed Again
1 1 1
2 2 2
3 3 10
4 4 3
5 9 9
6 5 4
7 6 5
8 7 6
9 8 7
10 10 8




.



Relevant Pages

  • Re: Pretty easy question, id assume..
    ... Or, if you really wanna save typing, you could loop over the ... controls on the buttons' container... ... >> make an eventhandler bij typing in a name in the propertieswindow. ... >> In the evenhandler you could typecast the sender parameter to a button ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Compendium
    ... God! ... Our Aunt told us not to take typing because if we knew how to type the ... I always thought it was fairly sound advice, ...
    (soc.motss)
  • Re: opening a form from a form
    ... well just enable the controls in the first place. ... One of the possible reasons for OP to use keyboard, like a single or two key ... Canceling as part of the event will leave the Dirty property at False. ... "I would like to enable as soon as any typing ...
    (microsoft.public.access.forms)
  • Re: Typing rate for CListCtrl and CComboBox
    ... The automatic "searching" of these controls seems buggy to me and inconsistent. ... CListCtrl, etc., and in the OnChar handler, have it do what you want (and don't ... >typing in a list control or combo box. ... >prefix and the next typed character wil be considered as ...
    (microsoft.public.vc.mfc)
  • Re: LEAD ACID BATTERY
    ... Please advice! ... "Summarize what you're following up. ... article, Google Groups includes the full article in quotes, with the ... go to the BOTTOM of the article and start typing there. ...
    (sci.electronics.basics)