Rows("1:1").Select
Selection.Copy
Rows("2:2").Select
Selection.Insert Shift:=xlDown
This code was generated from a macro I recorded in excel. It selects Row1, copy's it, selects Row2, and finally pastes the copied Row1 into Row2 shifting all the other rows down (right click, select Insert Copied Cells).
For an example, imagine that the spreadsheet looks like this :
1: Cell1, Cell2, Cell3
2: Data1, Data2, Data3
3: Foo01, Foo02, Foo03
After the macro runs you will have :
1: Cell1, Cell2, Cell3
2: Cell1, Cell2, Cell3
3: Data1, Data2, Data3
4: Foo01, Foo02, Foo03
This is what I am trying to achieve.
In addition, I feel like I'm working blind. Does anyone know of a guide to OLE and how to use it with perl? The Win32::OLE docs are great, but I'm having a hard time figuring out how to use all of the objects that I find in the Visual Basic Object View and the ActiveState OLE-Browser.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.