Insert new row with above active cell using vba excel

Iarianna81

New Member
Joined
Nov 22, 2017
Messages
6
Hi ,

i have data in column A, B ,C but i need to insert new row above active cell in coloum B

original format
ABC
4APPLE
SUGAR
MILK
WATER
5BANANA
SUGAR
MILK
WATER
10MANGGO
SUGAR
MILK
WATER

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


I found some macro using below code
Sub InsertRows()


Application.ScreenUpdating = False
Application.DisplayAlerts = False
With Range("B3", Range("B" & Rows.Count).End(xlUp))

.Subtotal GroupBy:=1, Function:=xlSum, TotalList:=Array(1), _
Replace:=True, PageBreaks:=False, SummaryBelowData:=True
.Offset(2, -1).SpecialCells(xlCellTypeConstants).Offset(, 1).ClearContents
.Offset(, -1).EntireColumn.Delete
.EntireColumn.RemoveSubtotal

End With

Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub



below data after i run this code...row insert below active cell...not above cell

ABC
4APPLE
SUGAR
MILK
WATER
5BANANA

SUGAR
MILK
WATER
10MANGGO
SUGAR
MILK
WATER

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


what i need is
ABC
4APPLE
SUGAR
MILK
WATER
5BANANA
SUGAR
MILK
WATER
10MANGGO
SUGAR
MILK
WATER

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

Thanks for your advance
***Kt***
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).

Forum statistics

Threads
1,215,761
Messages
6,126,735
Members
449,333
Latest member
Adiadidas

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