View Single Post
  #15   Report Post  
Posted to microsoft.public.excel.programming
Ron Rosenfeld[_2_] Ron Rosenfeld[_2_] is offline
external usenet poster
 
Posts: 1,045
Default leading zeros using ActiveCell.Offset().value to insert row and value

On Sun, 10 Feb 2013 19:43:27 +0000, TimLeonard wrote:

I feel I am not communicating.



Previously you specified that the format of the merged address should be
in the format of
LaaXnnn
where aa would be two digits in the range of 1-10 (eg 01-10)
X could be D or M
and nnn would be three digits in the range of 1-159 (eg 001-159)

This is still the correct format...and the way it would be assigned to a
device on the drawings...


Previously you wrote that the loops go from L01... to L10..., but column
D (LoopSelection) has values of 0, 1, 2.
What to do if the value in column D is zero?

In the loopselection column of the "paneldata" worksheet the zero is for
zones and can go up to the value of 10 depending on how many loop are
installed in the field panel.


But you wrote that I should "Look at Column D for the loop". If the loops MUST be in the range of one to ten (L01 - L10), what do you want to happen if the value in column D is zero??



Previously you wrote that what I am calling "X" (or "Part 2" in an
earlier post) could be a D or M, but if I am looking at column F, I see
values of 1, 2, 3 and 5.
What to do if the value is not 1 or 2?

On the "CompareData" worksheet the code from module 1 took the values
and made them either Devices or Modules, using the following
Range("E2").Formula =
"=IF(D2=3,""Zone"",IF(D2=2,""Monitor"",IF(D2=1,"" Detector"","""")))"
This was the only way I knew to get the "D" or "M" and while the "5"
isn't used in this I left it in the comparison... Additionally the
current values of 1, 2, 3 and 5 are what is used now but this area could
expand or change completely in the future and I would need the ability
to modify the code to work....


The question I am asking has to do with constructing the MERGED ADDRESS, which is supposed to be a D or an M. Your formula above is being used for a different purpose, and does not result in a D or M.
You wrote: Col. "F" for the D or M (1=Device and 2=Module 3=Zone), but since we are restricted to only D or M, I need to know what to do if the contents of Col F is not a one or a two.

(So far as populating column E in the CompareData sheet, we'll deal with that after I understand how to construct the Merged Address -- it will be simple in code and simple to maintain or expand).


Previously you wrote that what I am calling nnn above (or "Part 3" in an
earlier post) would be in the range of 1-159, but if I am looking at Col
"E", I see some values of zero (0).
What to do if the value is zero?

The range 1-159 represent the programmable device address range...and
the zero or zone numbers represent the panels logic...So at this point
zeros or zones has been kept in the mix for the comparison. However in
my code Module 2 merges the columns it put "L00" on them, which was the
best I could do... They should read either Zone 1-999 or Blank for 00-10
but this was too complicated for me to isolate so I left it alone...This
resulted in the L00000-L00009 and the L00Z000-L00Z999 you see in the
"Summary" and the CompareData" worksheets...


I'm sure the code I have can deal with what you want to do, but I don't understand what you want to do with regard to constructing a merged address with the specifications of that value being in the range of L01D001 to L10M159. Please try to be specific.

It doesn't matter what the 1-159 represents in terms of the programming. No matter what they represent, they will be the terminal three digits of "Merged Address". What matters is what you want to happen if the value in that column is outside of the range 1-159. In other words, what should happen to the Merged Address if the value in that column is zero?

Any number of things are possible, including constructing a Merged Address that does not conform to the specifications above, or even excluding that line from CompareData completely.. But if you want to include the line, you will need to decide what should be in the "Merged Address" column.

Either the specifications are incomplete, or there is a problem with the
data in this latest workbook. I've got the basics of the code set up,
but I need better specifications to proceed.


At this point I think the second workbook, as slow as it is and from
piecing various codes together, works through all we have discussed
except when adding missing addresses... But in some cases, it does not
complete to address 001 but would stop at address 005. This causes the
"Diff" worksheet to be populated with more cell differences than it
should...For example...
L01D159
L01M005
L01M006

Also, if a new loop was added, it doesn't check the "Summary" sheet to
see if it needs to be added there as well, nor does it write any data
changes from to "CompareData" sheet to the "Summary" sheet such as if
the programmed labels were different on the sheets and remove the column
"A" project number info...

Perhaps one disconnect is that I made all comments using the "Summary"
and "CompareData" sheets, which copies columns from the "PanelData
sheets and sorts the data and adds the above mentioned code for adding
the missing numbers, and I think now we are discussing using the
"PanelData" sheet for that info instead...


I was under the impression that PanelData represented the original data, and was derived from some source probably not under your control.
It will be far simpler to start at that point; construct the MergedAddresses according to a well defined algorithm; and then construct the CompareData and Summary sheets appropriately. Once this is done, it will be relatively simple to determine the cell differences.