Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
I have a spreadsheet that is tracking ownerships of land parcels for
importing into a database. Currently it has about 300+ records (rows). In column A, there is a field named Sort_Key. They are only whole numbers. The column is formatted as GENERAL, which when using a whole number, would connote a INTEGER format, right? Anyway, the whole idea behind the sort key concept is to allow me a way to revert back to the sequence that the data was originally entered, in case I changed the way the spreadsheet was sorted. I have been told that I will no longer be doing the data input on this spreadsheet, and because of that, will be forwarding the task of data input to a much a very inexperienced Excel user. This person will undoubtedly forget to add the sort key value whenever he adds/inserts a new row, I fear. To avert this potential catastrophe, the only thing that I can think of is a VBA script that will automatically insert a new Sort_Key value that is +1 (incremented) from the highest previous value. ------------------------------------------------------------------ The work flow for understanding the construction of the VBA script is as follows: 1 - User initializes INSERT ROW command. 2a - With Excel listening in the background for any INSERT ROW command, the VBA script initializes. 2b - A dialog box will pop up informing the user that upon completion of the VBA script, Excel is going to place a NEW, incremented value in the cell (in Col A) on the new row, for the new Sort Key. 2c - The user will would be prompted to select EITHER: "YES - proceed with new Sort Key Value" or "NO - I don't want to generate a new Sort Key at this time". If the user selects "No ...", then it will return to the cursor position, and the VBA script will abort. 3a - If the user selects "Yes..", then the VBA script will continue. 3b - The script will read in Col A the MAX value, insert it into the variable to be incremented, then increment it by 1. The output will be inserted in the new empty cell in Col A. 4 - Once this is done, the script will place the cursor in the next column (which is named: Tract No), and the routine will end. ------------------------------------------------------------------ Some other questions/comments: A) What if the user changes his mind and decides NOT to insert a row, and wishes to UNDO the new Sort Key? What are the ramifications here, if any? B) I was also thinking of another way to do this would be to have a custom button that is assigned to the VBA script. Whenever the user wanted to insert a new row, and then add a new Sort Key value. Since this could be construed as a "deliberate" action, it would do away steps 1, 2, and 3a. C) Is there a hidden value that Excel keeps that could be utilized (in some way) to satisfy this application? I hope that I've explained this sufficiently, but if not, please place your questions and I will respond to them promptly. Thanks in advance. Phil |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Auto insert row: | Excel Worksheet Functions | |||
auto insert | Excel Discussion (Misc queries) | |||
Can I auto insert a worksheet when I insert a value in a cell. | Excel Worksheet Functions | |||
auto row insert | Excel Worksheet Functions | |||
Auto Insert of Rows | Excel Worksheet Functions |