Identify numeric in column then....

sambuka

New Member
Joined
Mar 8, 2012
Messages
12
Need a code for : In a particular column (A) - if the previous cell is numeric then copy the previous row and paste insert down.

example

If
A3= 1234
A4= Text

Then copy row A3 and paste insert

Needs to loop and find all instances in that column, end loop when no more instances

Can this be done?
 

Some videos you may like

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!

texasalynn

Well-known Member
Joined
May 19, 2002
Messages
8,458
try this

Code:
Sub CopyNumericRow()
Dim LR As Long
LR = Range("A" & Rows.Count).End(xlUp).Row

For i = LR To 2 Step -1
     If IsNumeric(Cells(i, 1)) Then
        Rows(i + 1).Insert
        Rows(i).Copy Destination:=Rows(i + 1)
     End If
Next i

End Sub
 

sambuka

New Member
Joined
Mar 8, 2012
Messages
12
Almost there. However, it add rows below the text. in column (a) that when the value of the formula in a cell is populated (a21"9109846"), the value can be above the next category(a22"riesling") and even not display all of the values for that category. (example, if you copy row (a21"9109846") and insert copied cells down, (There is more data to be displayed)

I need to loop until there is an extra space (formulas included) between the (A21"9109846") and (A22"Riesling"). This has to be repeated for all cells in column A.

Let me know if you need more explanation

Category
Item ID
9089982
9079686
1848241
9109846
Riesling
Item ID

Needs to BE-------->>>

Category
Item ID
9089982
9079686
1848241
9109846
9109846
(This will be blank due to formula)
Riesling
Item ID
1848241


<tbody>
</tbody>



<tbody>
</tbody><colgroup><col></colgroup>
 

Watch MrExcel Video

Forum statistics

Threads
1,122,597
Messages
5,597,089
Members
414,122
Latest member
eazyyexcel

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top