ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Auto insert row while entering raw data (https://www.excelbanter.com/excel-discussion-misc-queries/193935-auto-insert-row-while-entering-raw-data.html)

mandapanda625

Auto insert row while entering raw data
 
As I am typing data into Column A, I would like my spreadsheet to
automatically add a row between the typed data and my summary two rows below
(when I press Enter). As a result, I would like two blank rows always
present between these pieces of information. If I cannot have this
automatic, at least a maco would be helpful.

Thanks!

Gord Dibben

Auto insert row while entering raw data
 
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column 1 Then Exit Sub
On Error GoTo CleanUp
Application.EnableEvents = False
With Target
If .Value < "" Then
.Offset(1, 0).EntireRow.Insert
End If
End With
CleanUp:
Application.EnableEvents = True
End Sub

This is sheet event code. Right-click on the sheet tab and "View Code"

Copy/paste the code into that sheet module. Alt + q to return to the Excel
window.

Assumes you already have two blank rows betweeb current data and summary row.


Gord Dibben MS Excel MVP

On Mon, 7 Jul 2008 12:17:01 -0700, mandapanda625
wrote:

As I am typing data into Column A, I would like my spreadsheet to
automatically add a row between the typed data and my summary two rows below
(when I press Enter). As a result, I would like two blank rows always
present between these pieces of information. If I cannot have this
automatic, at least a maco would be helpful.

Thanks!




All times are GMT +1. The time now is 03:03 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com