Need help for Excel's Macro:rows and keyword

March 1, 2011 at 10:00:03
Specs: Windows 7, Intel Core 2 Duo T9300/4gb DDR2
Hi everybody, I'm Ultraceo, and I'm new on this site.
I really need your help for a excel's macro.
I have thousands of datas in a single column, and I need to insert one blank row under each data, and a row with a specific keyword (for example: "price" above each data.

Here's an example:
I have a column like this:

DATA1
DATA2
DATA3
DATA4
DATA5
DATA6

I need to have the column like this:

price
DATA1

price
DATA2

price
DATA3

price
DATA4

price
DATA5

price
DATA6

I dindn't find anything like this in this forum, so I'll hope you'll help me.
Thank a lot.

Ultraceo


See More: Need help for Excels Macro:rows and keyword

Report •


#1
March 2, 2011 at 15:30:10
Assuming that your data starts in A1, this should get you what you are looking for.

Sub InsertTextAndRow()
rw = 1
 Do Until Cells(rw, 1) = ""
   Cells(rw, 1).Insert shift:=xlDown
   Cells(rw, 1) = "Price"
    rw = rw + 2
   Cells(rw, 1).Insert shift:=xlDown
    rw = rw + 1
 Loop
End Sub

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.


Report •

#2
March 2, 2011 at 16:18:31
Great!! It works.
Thanks A LOT!!!!!!

Report •

Related Solutions


Ask Question