Hi all.
I'm trying to create detailed report pages based on excel data.
Here's a little view to the sheet:
I've also attaced this sample if you want to work on it.
First of all, I want the method to "remember" some coulmns by their titles (they'll be always the same), and "know" where to find the needed data.
I guess it'll be several loops that search for "title" and strore the column indexes in variables. ("Business Name" into BusNameCol, "Sign Content" into SignContentCol, etc.)
Now, I want a loop that runs on "Property ID" column (its index will be stored in PropIDCol).
When the loop finds a "new" (not yet handled) value, it will:
For the method to know where to "return" to, my idea is to have a "check" column (its index in CheckCol). For every line the method handles, it'll put "1" in this column.
It also will be good if I want to run the macro several times (if businesses are added in future), and not to have multiple report files.
There is also line 12 in the picture, which doesn't have property and owner data, I think that in this case it will collect according to business name instead of property id.
-------------------------------------------------------
OUTPUT EXAMPLE:
BusinessName: Paz | Owner ID: 510216054 | Property ID: 166143000003 | Owner Name: Paz Company Ltd. | Owner Address: P.O.B. 222 City
<table class="MsoNormalTable" style="width: 445pt; margin-left: 5.15pt; border-collapse: collapse;" border="0" cellpadding="0" cellspacing="0" width="593"><tbody><tr style="height: 12.75pt;"><td style="width: 111pt; padding: 0cm 5.4pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="148"><link rel="File-List" href="file:///C:%5CDOCUME%7E1%5C-A290%7E1.3DL%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml"><!--[if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:Compatibility> <w:BreakWrappedTables/> <w:SnapToGridInCell/> <w:WrapTextWithPunct/> <w:UseAsianBreakRules/> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><style> <!-- /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0cm; margin-bottom:.0001pt; text-align:right; mso-pagination:widow-orphan; direction:rtl; unicode-bidi:embed; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";} @page Section1 {size:612.0pt 792.0pt; margin:72.0pt 90.0pt 72.0pt 90.0pt; mso-header-margin:36.0pt; mso-footer-margin:36.0pt; mso-paper-source:0;} div.Section1 {page:Section1;} --> </style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"טבלה רגילה"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman";} </style> <![endif]--> <table class="MsoNormalTable" style="width: 445pt; margin-left: 5.15pt; border-collapse: collapse;" border="0" cellpadding="0" cellspacing="0" width="593"> <tbody><tr style="height: 12.75pt;"> <td style="width: 111pt; padding: 0cm 5.4pt; height: 12.75pt;" nowrap="nowrap" width="148"> </td> <td style="width: 48pt; padding: 0cm 5.4pt; height: 12.75pt;" nowrap="nowrap" width="64"> </td> <td style="width: 48pt; padding: 0cm 5.4pt; height: 12.75pt;" nowrap="nowrap" width="64"> </td> <td style="width: 48pt; padding: 0cm 5.4pt; height: 12.75pt;" nowrap="nowrap" width="64"> </td> <td style="width: 55pt; padding: 0cm 5.4pt; height: 12.75pt;" nowrap="nowrap" width="73"> </td> <td style="width: 55pt; padding: 0cm 5.4pt; height: 12.75pt;" nowrap="nowrap" width="73"> </td> <td style="width: 80pt; padding: 0cm 5.4pt; height: 12.75pt;" nowrap="nowrap" width="107"> </td> </tr> <tr style="height: 12.75pt;"> <td style="width: 111pt; padding: 0cm 5.4pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="148">
</td><td style="width: 48pt; padding: 0cm 5.4pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="64">
</td><td style="width: 48pt; padding: 0cm 5.4pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="64">
</td><td style="width: 55pt; padding: 0cm 5.4pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="73">
</td><td style="width: 55pt; padding: 0cm 5.4pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="73">
</td><td style="width: 80pt; padding: 0cm 5.4pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="107">
</td></tr></tbody></table>-------------------------------------------------------
I'm trying to create detailed report pages based on excel data.
Here's a little view to the sheet:
I've also attaced this sample if you want to work on it.
First of all, I want the method to "remember" some coulmns by their titles (they'll be always the same), and "know" where to find the needed data.
I guess it'll be several loops that search for "title" and strore the column indexes in variables. ("Business Name" into BusNameCol, "Sign Content" into SignContentCol, etc.)
Now, I want a loop that runs on "Property ID" column (its index will be stored in PropIDCol).
When the loop finds a "new" (not yet handled) value, it will:
- Create a new file, named as the property id value.
- Print to file, *only once*, some values like businnes name, owner name, etc. (their column indexes are stored)
- Print in a new line some other values, like sign content, width, height, etc. (their column indexes are stored)
- Loop on the rest of lines of the current handled "Property ID", and continue creating new lines for those same other values.
>>> NOTICE:
Same property ids are not all in sequence! So it's not a simple "while" loop.
It'll need to "collect" from the close range (let's say 50 lines).
Same property ids are not all in sequence! So it's not a simple "while" loop.
It'll need to "collect" from the close range (let's say 50 lines).
- After that, it'll return to the "main" loop and move to the next "new" property id.
For the method to know where to "return" to, my idea is to have a "check" column (its index in CheckCol). For every line the method handles, it'll put "1" in this column.
It also will be good if I want to run the macro several times (if businesses are added in future), and not to have multiple report files.
There is also line 12 in the picture, which doesn't have property and owner data, I think that in this case it will collect according to business name instead of property id.
-------------------------------------------------------
OUTPUT EXAMPLE:
BusinessName: Paz | Owner ID: 510216054 | Property ID: 166143000003 | Owner Name: Paz Company Ltd. | Owner Address: P.O.B. 222 City
<table class="MsoNormalTable" style="width: 445pt; margin-left: 5.15pt; border-collapse: collapse;" border="0" cellpadding="0" cellspacing="0" width="593"><tbody><tr style="height: 12.75pt;"><td style="width: 111pt; padding: 0cm 5.4pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="148"><link rel="File-List" href="file:///C:%5CDOCUME%7E1%5C-A290%7E1.3DL%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml"><!--[if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:Compatibility> <w:BreakWrappedTables/> <w:SnapToGridInCell/> <w:WrapTextWithPunct/> <w:UseAsianBreakRules/> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><style> <!-- /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0cm; margin-bottom:.0001pt; text-align:right; mso-pagination:widow-orphan; direction:rtl; unicode-bidi:embed; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";} @page Section1 {size:612.0pt 792.0pt; margin:72.0pt 90.0pt 72.0pt 90.0pt; mso-header-margin:36.0pt; mso-footer-margin:36.0pt; mso-paper-source:0;} div.Section1 {page:Section1;} --> </style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"טבלה רגילה"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman";} </style> <![endif]--> <table class="MsoNormalTable" style="width: 445pt; margin-left: 5.15pt; border-collapse: collapse;" border="0" cellpadding="0" cellspacing="0" width="593"> <tbody><tr style="height: 12.75pt;"> <td style="width: 111pt; padding: 0cm 5.4pt; height: 12.75pt;" nowrap="nowrap" width="148">
Sign Content<o></o>
Width (cm)<o></o>
Height (cm)<o></o>
Rounded Area<o></o>
Sign Address - Street<o></o>
Sign Address - House<o></o>
Sign Location<o></o>
Tasty Yellow<o></o>
</td> <td style="width: 48pt; padding: 0cm 5.4pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="64"> 250<o></o>
</td> <td style="width: 48pt; padding: 0cm 5.4pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="64"> 230<o></o>
</td> <td style="width: 48pt; padding: 0cm 5.4pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="64"> 6<o></o>
</td> <td style="width: 55pt; padding: 0cm 5.4pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="73"> rd. 434<o></o>
</td> <td style="width: 55pt; padding: 0cm 5.4pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="73"> 21<o></o>
</td> <td style="width: 80pt; padding: 0cm 5.4pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="107"> Display Window<o></o>
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 111pt; padding: 0cm 5.4pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="148"> Paz (changing ads)<o></o>
</td> <td style="width: 48pt; padding: 0cm 5.4pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="64"> 90<o></o>
</td> <td style="width: 48pt; padding: 0cm 5.4pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="64"> 60<o></o>
</td> <td style="width: 48pt; padding: 0cm 5.4pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="64"> 1<o></o>
</td> <td style="width: 55pt; padding: 0cm 5.4pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="73"> rd. 434<o></o>
</td> <td style="width: 55pt; padding: 0cm 5.4pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="73"> 21<o></o>
</td> <td style="width: 80pt; padding: 0cm 5.4pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="107"> Bulding Wall<o></o>
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 111pt; padding: 0cm 5.4pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="148"> Paz (changing ads)<o></o>
</td> <td style="width: 48pt; padding: 0cm 5.4pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="64"> 90<o></o>
</td> <td style="width: 48pt; padding: 0cm 5.4pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="64"> 60<o></o>
</td> <td style="width: 48pt; padding: 0cm 5.4pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="64"> 1<o></o>
</td> <td style="width: 55pt; padding: 0cm 5.4pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="73"> rd. 434<o></o>
</td> <td style="width: 55pt; padding: 0cm 5.4pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="73"> 21<o></o>
</td> <td style="width: 80pt; padding: 0cm 5.4pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="107"> Bulding Wall<o></o>
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 111pt; padding: 0cm 5.4pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="148"> Price List<o></o>
</td> <td style="width: 48pt; padding: 0cm 5.4pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="64"> 120<o></o>
</td> <td style="width: 48pt; padding: 0cm 5.4pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="64"> 60<o></o>
</td> <td style="width: 48pt; padding: 0cm 5.4pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="64"> 1<o></o>
</td> <td style="width: 55pt; padding: 0cm 5.4pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="73"> rd. 434<o></o>
</td> <td style="width: 55pt; padding: 0cm 5.4pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="73"> 21<o></o>
</td> <td style="width: 80pt; padding: 0cm 5.4pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="107"> Pole<o></o>
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 111pt; padding: 0cm 5.4pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="148"> Paz<o></o>
</td> <td style="width: 48pt; padding: 0cm 5.4pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="64"> 80<o></o>
</td> <td style="width: 48pt; padding: 0cm 5.4pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="64"> 60<o></o>
</td> <td style="width: 48pt; padding: 0cm 5.4pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="64"> 1<o></o>
</td> <td style="width: 55pt; padding: 0cm 5.4pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="73"> rd. 434<o></o>
</td> <td style="width: 55pt; padding: 0cm 5.4pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="73"> 23<o></o>
</td> <td style="width: 80pt; padding: 0cm 5.4pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="107"> Gas Station<o></o>
</td> </tr> </tbody></table> </td><td style="width: 48pt; padding: 0cm 5.4pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="64"></td><td style="width: 48pt; padding: 0cm 5.4pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="64">
</td><td style="width: 48pt; padding: 0cm 5.4pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="64">
</td><td style="width: 55pt; padding: 0cm 5.4pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="73">
</td><td style="width: 55pt; padding: 0cm 5.4pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="73">
</td><td style="width: 80pt; padding: 0cm 5.4pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="107">
</td></tr></tbody></table>-------------------------------------------------------