I need a macro that will put values starting from 1 to required number sequentially (i.e. col# will be col1 then col2 and so on and it will start from col1 in every "<row>...</row>"
In details, sample 1 will become sample 2.
Sample 1:
Sample 2:
I have created a macro which works fine normally but it does not work when I put a loop in it or check on the box saying "run till the end of file".
Macro code:
In details, sample 1 will become sample 2.
Sample 1:
Code: Select all
<tabular xml:id="jofi844-tbl-0001" pRights="unknown" eRights="yes">
<title type="main">TABLE 1 S<sc>ecurity</sc> O<sc>fferings of</sc> U.S. B<sc>usiness</sc> C<sc>orporations</sc> 1950–1965</title>
<table frame="topbot" colsep="0" rowsep="0" pgwide="1">
<tgroup cols="7">
<colspec colnum="1" colname="col1" align="left"/>
<colspec colnum="2" colname="col2" align="left"/>
<colspec colnum="3" colname="col3" align="left"/>
<colspec colnum="4" colname="col4" align="left"/>
<colspec colnum="5" colname="col5" align="left"/>
<colspec colnum="6" colname="col6" align="left"/>
<colspec colnum="7" colname="col7" align="left"/>
<thead><row>
<entry colname="col#" valign="bottom">Year</entry>
<entry colname="col#" valign="bottom">Total Corporate Securities Issued<link href="#jofi844-tbl-note-0001"><sup>a</sup></link></entry>
<entry colname="col#" valign="bottom">Total Common Stock Issued<link href="#jofi844-tbl-note-0002"><sup>b</sup></link></entry>
<entry colname="col#" valign="bottom">Total Preferred Stock Issued<link href="#jofi844-tbl-note-0002"><sup>c</sup></link></entry>
<entry colname="col#" valign="bottom">Non-Convertible Preferred Stock Issued<link href="#jofi844-tbl-note-0003"><sup>d</sup></link></entry>
<entry colname="col#" valign="bottom">Non-Convertible as a Per Cent of Total Corporate Securities</entry>
<entry colname="col#" valign="bottom">Non-Convertible as a Per Cent of Total Preferred</entry>
</row></thead>
<tbody>
<row>
<entry colname="col#"/>
<entry colname="col#"/>
<entry colname="col#"/>
<entry colname="col#"/>
<entry colname="col#"/>
<entry colname="col#"><math display="inline" xmlns="http://www.w3.org/1998/Math/MathML" altimg="urn:x-wiley:00221082:jofi844:equation:jofi844-math-0001" wiley:location="equation/jofi844-math-0001.png">$\left(\underline {4} \right)$</math></entry>
<entry colname="col#"><math display="inline" xmlns="http://www.w3.org/1998/Math/MathML" altimg="urn:x-wiley:00221082:jofi844:equation:jofi844-math-0002" wiley:location="equation/jofi844-math-0002.png">$\left(\underline {4} \right)$</math></entry>
</row>
<row>
<entry colname="col#"/>
<entry colname="col#">(1)</entry>
<entry colname="col#">(2)</entry>
<entry colname="col#">(3)</entry>
<entry colname="col#">(4)</entry>
<entry colname="col#">(1)</entry>
<entry colname="col#">(3)</entry>
</row>
<row>
<entry colname="col#">1950</entry>
<entry colname="col#">$ 6,361</entry>
<entry colname="col#">$ 810</entry>
<entry colname="col#">$ 630</entry>
<entry colname="col#">$ 409</entry>
<entry colname="col#">6.4%</entry>
<entry colname="col#">64.9%</entry>
</row>
<row>
<entry colname="col#">1951</entry>
<entry colname="col#">7,741</entry>
<entry colname="col#">1,216</entry>
<entry colname="col#">837</entry>
<entry colname="col#">271</entry>
<entry colname="col#">3.5</entry>
<entry colname="col#">32.4</entry>
</row>
<row>
<entry colname="col#">1952</entry>
<entry colname="col#">9,534</entry>
<entry colname="col#">1,368</entry>
<entry colname="col#">564</entry>
<entry colname="col#">268</entry>
<entry colname="col#">2.8</entry>
<entry colname="col#">47.5</entry>
</row>
<row>
<entry colname="col#">1953</entry>
<entry colname="col#">8,898</entry>
<entry colname="col#">1,326</entry>
<entry colname="col#">488</entry>
<entry colname="col#">382</entry>
<entry colname="col#">4.3</entry>
<entry colname="col#">78.3</entry>
</row>
<row>
<entry colname="col#">1954</entry>
<entry colname="col#">9,516</entry>
<entry colname="col#">1,213</entry>
<entry colname="col#">816</entry>
<entry colname="col#">518</entry>
<entry colname="col#">5.4</entry>
<entry colname="col#">63.5</entry>
</row>
<row>
<entry colname="col#">1955</entry>
<entry colname="col#">10,240</entry>
<entry colname="col#">2,185</entry>
<entry colname="col#">635</entry>
<entry colname="col#">388</entry>
<entry colname="col#">3.8</entry>
<entry colname="col#">61.1</entry>
</row>
<row>
<entry colname="col#">1956</entry>
<entry colname="col#">10,939</entry>
<entry colname="col#">2,301</entry>
<entry colname="col#">636</entry>
<entry colname="col#">319</entry>
<entry colname="col#">2.9</entry>
<entry colname="col#">50.2</entry>
</row>
<row>
<entry colname="col#">1957</entry>
<entry colname="col#">12,884</entry>
<entry colname="col#">2,516</entry>
<entry colname="col#">411</entry>
<entry colname="col#">216</entry>
<entry colname="col#">1.7</entry>
<entry colname="col#">52.6</entry>
</row>
<row>
<entry colname="col#">1958</entry>
<entry colname="col#">11,558</entry>
<entry colname="col#">1,334</entry>
<entry colname="col#">571</entry>
<entry colname="col#">372</entry>
<entry colname="col#">3.2</entry>
<entry colname="col#">65.1</entry>
</row>
<row>
<entry colname="col#">1959</entry>
<entry colname="col#">9,748</entry>
<entry colname="col#">2,027</entry>
<entry colname="col#">531</entry>
<entry colname="col#">238</entry>
<entry colname="col#">2.4</entry>
<entry colname="col#">44.8</entry>
</row>
<row>
<entry colname="col#">1960</entry>
<entry colname="col#">10,154</entry>
<entry colname="col#">1,664</entry>
<entry colname="col#">409</entry>
<entry colname="col#">335</entry>
<entry colname="col#">3.3</entry>
<entry colname="col#">81.9</entry>
</row>
<row>
<entry colname="col#">1961</entry>
<entry colname="col#">13,165</entry>
<entry colname="col#">3,294</entry>
<entry colname="col#">449</entry>
<entry colname="col#">255</entry>
<entry colname="col#">1.9</entry>
<entry colname="col#">56.8</entry>
</row>
<row>
<entry colname="col#">1962</entry>
<entry colname="col#">10,705</entry>
<entry colname="col#">1,314</entry>
<entry colname="col#">422</entry>
<entry colname="col#">202</entry>
<entry colname="col#">1.9</entry>
<entry colname="col#">47.9</entry>
</row>
<row>
<entry colname="col#">1963</entry>
<entry colname="col#">12,237</entry>
<entry colname="col#">1,022</entry>
<entry colname="col#">342</entry>
<entry colname="col#">245</entry>
<entry colname="col#">2.0</entry>
<entry colname="col#">71.6</entry>
</row>
<row>
<entry colname="col#">1964</entry>
<entry colname="col#">13,957</entry>
<entry colname="col#">2,679</entry>
<entry colname="col#">412</entry>
<entry colname="col#">279</entry>
<entry colname="col#">2.0</entry>
<entry colname="col#">67.7</entry>
</row>
<row>
<entry colname="col#">1965</entry>
<entry colname="col#" rowsep="1">15,992</entry>
<entry colname="col#" rowsep="1">1,547</entry>
<entry colname="col#" rowsep="1">725</entry>
<entry colname="col#" rowsep="1">449</entry>
<entry colname="col#">2.8</entry>
<entry colname="col#">61.9</entry>
</row>
<row>
<entry colname="col#">Totals</entry>
<entry colname="col#">$173,629</entry>
<entry colname="col#">$27,716</entry>
<entry colname="col#">$8,878</entry>
<entry colname="col#">$5,146</entry>
<entry colname="col#"/>
<entry colname="col#"/></row>
</tbody>
</tgroup>
</table>
<noteGroup xml:id="jofi844-ntgp-0002">
<note xml:id="jofi844-tbl-note-0001">
<label>a</label><p>1950–1954, <i>Federal Reserve Bulletin</i>., January, 1957, p. 62. 1955–1961, <i>Federal Reserve Bulletin</i>., June, 1963, p. 829. 1962–1965, <i>Federal Reserve Bulletin</i>., June, 1966, p. 867.</p>
</note>
<note xml:id="jofi844-tbl-note-0002">
<label>b,c</label><p>Estimates of the Securities and Exchange Commission as reported in the <i>Federal Reserve Bulletin</i>., June, 1953, p. 634; December, 1961, p. 1450; April, 1962, p. 446; and June, 1966, p. 867.</p>
</note>
<note xml:id="jofi844-tbl-note-0003">
<label>d</label><p>Refer to Footnote 4.</p>
</note>
</noteGroup>
</tabular>
Code: Select all
<tabular xml:id="jofi844-tbl-0001" pRights="unknown" eRights="yes">
<title type="main">TABLE 1 S<sc>ecurity</sc> O<sc>fferings of</sc> U.S. B<sc>usiness</sc> C<sc>orporations</sc> 1950–1965</title>
<table frame="topbot" colsep="0" rowsep="0" pgwide="1">
<tgroup cols="7">
<colspec colnum="1" colname="col1" align="left"/>
<colspec colnum="2" colname="col2" align="left"/>
<colspec colnum="3" colname="col3" align="left"/>
<colspec colnum="4" colname="col4" align="left"/>
<colspec colnum="5" colname="col5" align="left"/>
<colspec colnum="6" colname="col6" align="left"/>
<colspec colnum="7" colname="col7" align="left"/>
<thead><row>
<entry colname="col1" valign="bottom">Year</entry>
<entry colname="col2" valign="bottom">Total Corporate Securities Issued<link href="#jofi844-tbl-note-0001"><sup>a</sup></link></entry>
<entry colname="col3" valign="bottom">Total Common Stock Issued<link href="#jofi844-tbl-note-0002"><sup>b</sup></link></entry>
<entry colname="col4" valign="bottom">Total Preferred Stock Issued<link href="#jofi844-tbl-note-0002"><sup>c</sup></link></entry>
<entry colname="col5" valign="bottom">Non-Convertible Preferred Stock Issued<link href="#jofi844-tbl-note-0003"><sup>d</sup></link></entry>
<entry colname="col6" valign="bottom">Non-Convertible as a Per Cent of Total Corporate Securities</entry>
<entry colname="col7" valign="bottom">Non-Convertible as a Per Cent of Total Preferred</entry>
</row></thead>
<tbody>
<row>
<entry colname="col1"/>
<entry colname="col2"/>
<entry colname="col3"/>
<entry colname="col4"/>
<entry colname="col5"/>
<entry colname="col6"><math display="inline" xmlns="http://www.w3.org/1998/Math/MathML" altimg="urn:x-wiley:00221082:jofi844:equation:jofi844-math-0001" wiley:location="equation/jofi844-math-0001.png">$\left(\underline {4} \right)$</math></entry>
<entry colname="col7"><math display="inline" xmlns="http://www.w3.org/1998/Math/MathML" altimg="urn:x-wiley:00221082:jofi844:equation:jofi844-math-0002" wiley:location="equation/jofi844-math-0002.png">$\left(\underline {4} \right)$</math></entry>
</row>
<row>
<entry colname="col1"/>
<entry colname="col2">(1)</entry>
<entry colname="col3">(2)</entry>
<entry colname="col4">(3)</entry>
<entry colname="col5">(4)</entry>
<entry colname="col6">(1)</entry>
<entry colname="col7">(3)</entry>
</row>
<row>
<entry colname="col1">1950</entry>
<entry colname="col2">$ 6,361</entry>
<entry colname="col3">$ 810</entry>
<entry colname="col4">$ 630</entry>
<entry colname="col5">$ 409</entry>
<entry colname="col6">6.4%</entry>
<entry colname="col7">64.9%</entry>
</row>
<row>
<entry colname="col1">1951</entry>
<entry colname="col2">7,741</entry>
<entry colname="col3">1,216</entry>
<entry colname="col4">837</entry>
<entry colname="col5">271</entry>
<entry colname="col6">3.5</entry>
<entry colname="col7">32.4</entry>
</row>
<row>
<entry colname="col1">1952</entry>
<entry colname="col2">9,534</entry>
<entry colname="col3">1,368</entry>
<entry colname="col4">564</entry>
<entry colname="col5">268</entry>
<entry colname="col6">2.8</entry>
<entry colname="col7">47.5</entry>
</row>
<row>
<entry colname="col1">1953</entry>
<entry colname="col2">8,898</entry>
<entry colname="col3">1,326</entry>
<entry colname="col4">488</entry>
<entry colname="col5">382</entry>
<entry colname="col6">4.3</entry>
<entry colname="col7">78.3</entry>
</row>
<row>
<entry colname="col1">1954</entry>
<entry colname="col2">9,516</entry>
<entry colname="col3">1,213</entry>
<entry colname="col4">816</entry>
<entry colname="col5">518</entry>
<entry colname="col6">5.4</entry>
<entry colname="col7">63.5</entry>
</row>
<row>
<entry colname="col1">1955</entry>
<entry colname="col2">10,240</entry>
<entry colname="col3">2,185</entry>
<entry colname="col4">635</entry>
<entry colname="col5">388</entry>
<entry colname="col6">3.8</entry>
<entry colname="col7">61.1</entry>
</row>
<row>
<entry colname="col1">1956</entry>
<entry colname="col2">10,939</entry>
<entry colname="col3">2,301</entry>
<entry colname="col4">636</entry>
<entry colname="col5">319</entry>
<entry colname="col6">2.9</entry>
<entry colname="col7">50.2</entry>
</row>
<row>
<entry colname="col1">1957</entry>
<entry colname="col2">12,884</entry>
<entry colname="col3">2,516</entry>
<entry colname="col4">411</entry>
<entry colname="col5">216</entry>
<entry colname="col6">1.7</entry>
<entry colname="col7">52.6</entry>
</row>
<row>
<entry colname="col1">1958</entry>
<entry colname="col2">11,558</entry>
<entry colname="col3">1,334</entry>
<entry colname="col4">571</entry>
<entry colname="col5">372</entry>
<entry colname="col6">3.2</entry>
<entry colname="col7">65.1</entry>
</row>
<row>
<entry colname="col1">1959</entry>
<entry colname="col2">9,748</entry>
<entry colname="col3">2,027</entry>
<entry colname="col4">531</entry>
<entry colname="col5">238</entry>
<entry colname="col6">2.4</entry>
<entry colname="col7">44.8</entry>
</row>
<row>
<entry colname="col1">1960</entry>
<entry colname="col2">10,154</entry>
<entry colname="col3">1,664</entry>
<entry colname="col4">409</entry>
<entry colname="col5">335</entry>
<entry colname="col6">3.3</entry>
<entry colname="col7">81.9</entry>
</row>
<row>
<entry colname="col1">1961</entry>
<entry colname="col2">13,165</entry>
<entry colname="col3">3,294</entry>
<entry colname="col4">449</entry>
<entry colname="col5">255</entry>
<entry colname="col6">1.9</entry>
<entry colname="col7">56.8</entry>
</row>
<row>
<entry colname="col1">1962</entry>
<entry colname="col2">10,705</entry>
<entry colname="col3">1,314</entry>
<entry colname="col4">422</entry>
<entry colname="col5">202</entry>
<entry colname="col6">1.9</entry>
<entry colname="col7">47.9</entry>
</row>
<row>
<entry colname="col1">1963</entry>
<entry colname="col2">12,237</entry>
<entry colname="col3">1,022</entry>
<entry colname="col4">342</entry>
<entry colname="col5">245</entry>
<entry colname="col6">2.0</entry>
<entry colname="col7">71.6</entry>
</row>
<row>
<entry colname="col1">1964</entry>
<entry colname="col2">13,957</entry>
<entry colname="col3">2,679</entry>
<entry colname="col4">412</entry>
<entry colname="col5">279</entry>
<entry colname="col6">2.0</entry>
<entry colname="col7">67.7</entry>
</row>
<row>
<entry colname="col1">1965</entry>
<entry colname="col2" rowsep="1">15,992</entry>
<entry colname="col3" rowsep="1">1,547</entry>
<entry colname="col4" rowsep="1">725</entry>
<entry colname="col5" rowsep="1">449</entry>
<entry colname="col6">2.8</entry>
<entry colname="col7">61.9</entry>
</row>
<row>
<entry colname="col1">Totals</entry>
<entry colname="col2">$173,629</entry>
<entry colname="col3">$27,716</entry>
<entry colname="col4">$8,878</entry>
<entry colname="col5">$5,146</entry>
<entry colname="col6"/>
<entry colname="col7"/></row>
</tbody>
</tgroup>
</table>
<noteGroup xml:id="jofi844-ntgp-0002">
<note xml:id="jofi844-tbl-note-0001">
<label>a</label><p>1950–1954, <i>Federal Reserve Bulletin</i>., January, 1957, p. 62. 1955–1961, <i>Federal Reserve Bulletin</i>., June, 1963, p. 829. 1962–1965, <i>Federal Reserve Bulletin</i>., June, 1966, p. 867.</p>
</note>
<note xml:id="jofi844-tbl-note-0002">
<label>b,c</label><p>Estimates of the Securities and Exchange Commission as reported in the <i>Federal Reserve Bulletin</i>., June, 1953, p. 634; December, 1961, p. 1450; April, 1962, p. 446; and June, 1966, p. 867.</p>
</note>
<note xml:id="jofi844-tbl-note-0003">
<label>d</label><p>Refer to Footnote 4.</p>
</note>
</noteGroup>
</tabular>
Macro code:
Code: Select all
InsertMode
ColumnModeOff
HexOff
PerlReOn
Find RegExp "(?s)<row>.*</row>"
Copy
Open "C:\Users\user\Desktop\tab1.txt"
Paste
Open "C:\Users\user\Desktop\tab1 - Copy.txt"
Paste
Top
PerlReOn
Find RegExp "<row>\r\n"
Replace All ""
PerlReOn
Find RegExp "\r\n</row>"
Replace All ""
PerlReOn
Find RegExp "<entry(.*.)</entry>"
Replace All "col#"
ColumnModeOn
SelectToBottom
StartSelect
Key Ctrl+END
ColumnInsertNum 1 1 LeadingZero
Key SHIFT
Key END
Copy
CloseFile NoSave
Top
PerlReOn
Find RegExp "#"
Paste
ColumnModeOff
EndSelect
Top
PerlReOn
Find RegExp ""col0"
Replace All ""col"
PerlReOn
Find RegExp " ""
Replace All """
SelectAll
StartSelect
Copy
CloseFile NoSave
Paste