Identify numeric in column then....

sambuka

New Member
Joined
Mar 8, 2012
Messages
18
Office Version
  1. 365
Platform
  1. Windows
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?
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
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
 
Upvote 0
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>
 
Upvote 0

Forum statistics

Threads
1,213,536
Messages
6,114,215
Members
448,554
Latest member
Gleisner2

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
Back
Top