Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8
Default Automatically insert a new row when certain number is entered in c

I would like a new row automatically inserted under each cell in a worksheet
that receives a .5 entry. Any ideas? The only entries allowed in the cells
are 1 or .5
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 248
Default Automatically insert a new row when certain number is entered in c

Right-click on the sheetname at the bottom of the screen and
paste the following code

Private Sub Worksheet_Change(ByVal Target As Range)
'Do nothing if more than one cell is changed or content deleted
If Target.Cells.Count 1 Or IsEmpty(Target) Then Exit Sub
'Check whether the cell value is 0.5
If Target.Value = 0.5 Then
'Insert a row below the cell with value 0.5
Target.Offset(1, 0).EntireRow.Insert
End If
End Sub

Now a row will be inserted below the cell if you enter 0.5 in any cell

If you want to insert only a cell then use
Private Sub Worksheet_Change(ByVal Target As Range)
'Do nothing if more than one cell is changed or content deleted
If Target.Cells.Count 1 Or IsEmpty(Target) Then Exit Sub
'Check whether the cell value is 0.5
If Target.Value = 0.5 Then
'Insert a row below the cell with value 0.5
Target.Offset(1, 0).Insert Shift:=xlDown
End If
End Sub
-------------------------------------
Pl. click ''Yes'' if this was helpful...



"Question, Mark" wrote:

I would like a new row automatically inserted under each cell in a worksheet
that receives a .5 entry. Any ideas? The only entries allowed in the cells
are 1 or .5

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Automatically insert time in excel but not automatically updated NeueN Excel Worksheet Functions 4 December 25th 08 07:29 AM
How to insert row automatically after certain number? ghost Excel Discussion (Misc queries) 1 June 10th 08 12:59 PM
Change value of cell automatically if entered the wrong number Pair_of_Scissors Excel Worksheet Functions 7 May 22nd 08 10:45 AM
How to automatically insert date when text entered in neighboring ek10101 Excel Discussion (Misc queries) 7 May 2nd 06 04:25 PM
Can you automatically insert next sequential number in an excel fo jo_9865 Excel Discussion (Misc queries) 2 August 4th 05 10:58 PM


All times are GMT +1. The time now is 08:30 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"