PC Review


Reply
Thread Tools Rate Thread

how to automatically insert row when i hit enter

 
 
Dano
Guest
Posts: n/a
 
      19th Nov 2003
I've got a list in a1 to a10, at the bottom of the list i have a sum of a1
to a10. when hitting enter in a10, how could i automatically insert a row
so i can enter more data?


 
Reply With Quote
 
 
 
 
Don Guillett
Guest
Posts: n/a
 
      19th Nov 2003
try this
right click sheet tab>view code>insert this>SAVE

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$A$10" Then Target.Rows.Insert
End Sub

--
Don Guillett
SalesAid Software
(E-Mail Removed)
"Dano" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I've got a list in a1 to a10, at the bottom of the list i have a sum of a1
> to a10. when hitting enter in a10, how could i automatically insert a row
> so i can enter more data?
>
>



 
Reply With Quote
 
Gord Dibben
Guest
Posts: n/a
 
      19th Nov 2003
Dano

"Automatically" would involve VBA code. See David McRitchie's "insertrow"
code.

http://www.mvps.org/dmcritchie/excel/insrtrow.htm

Gord Dibben XL2002

On Wed, 19 Nov 2003 10:43:06 -0600, "Dano" <(E-Mail Removed)> wrote:

>I've got a list in a1 to a10, at the bottom of the list i have a sum of a1
>to a10. when hitting enter in a10, how could i automatically insert a row
>so i can enter more data?
>


 
Reply With Quote
 
Earl Kiosterud
Guest
Posts: n/a
 
      19th Nov 2003
Dano,

If you'll be adding more and more rows (A11, then A12, etc), this approach
might work for you.

Insert a row after your last data row.
Modify your SUM formula to include it (A1:A11).
Select A1:A11 and name it MyData
You can hide row A11. You'll not be putting anything in it. It's only
there to allow you to insert a row inside the range that your SUM formula
refers to, so it will expand automatically.

Put the following sub in the sheet module:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row = Range("MyData").Row + Range("MyData").Rows.Count - 2 Then
Application.EnableEvents = False
Target.Offset(1, 0).EntireRow.Insert xlUp
Application.EnableEvents = True
End If
End Sub

This won't copy down any formulas into the newly inserted row, though that
can be added. And it can get stuck if it crashes, leaving events turned
off. But see if it's what you like.
--
Earl Kiosterud
mvpearl omitthisword at verizon period net
-------------------------------------------

"Dano" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I've got a list in a1 to a10, at the bottom of the list i have a sum of a1
> to a10. when hitting enter in a10, how could i automatically insert a row
> so i can enter more data?
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Automatically insert time in excel but not automatically updated NeueN Microsoft Excel Worksheet Functions 5 14th Apr 2012 11:30 AM
Need to insert row with enter key =?Utf-8?B?QWltekc4UmZhbg==?= Microsoft Excel Worksheet Functions 7 7th May 2005 12:13 AM
how to insert row automatically after hitting enter at the end of. =?Utf-8?B?QWxp?= Microsoft Excel Worksheet Functions 1 11th Nov 2004 07:24 AM
how to insert <Enter> in .bat file JW Windows XP Basics 5 3rd Jun 2004 01:39 AM
insert the date automatically, and insert a number automatically KC Microsoft Excel Worksheet Functions 3 16th Mar 2004 10:26 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:17 PM.