Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Need Help Immediately

Hi,
I want to know how can we use the same formula in all the new
cells inserted, programatically in VBA.

For example:
i have a formula for the cell D1 as (A1+B1+C1)/3 .now suppose i
insert a new cell D5 i want the same formula to be there for this cell
also which should be (A5+B5+C5)/3.

Is it possible to do it programatically?

Could anyone look into this as soon as possible?

Awaiting for the reply

Regards,
Padmaja



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 176
Default Need Help Immediately

Padmaja,

Immediately after you insert cell D5, simply type Ctrl-' - the key
combination CTRL and single quote. That will copy the formula from
the cell above.

To do this automatically would require a lot of logic and coding,
since Excel doesn't have a cell insertion event.

HTH,
Bernie


"padmaja" wrote in message
...
Hi,
I want to know how can we use the same formula in all the new
cells inserted, programatically in VBA.

For example:
i have a formula for the cell D1 as (A1+B1+C1)/3 .now suppose i
insert a new cell D5 i want the same formula to be there for this

cell
also which should be (A5+B5+C5)/3.

Is it possible to do it programatically?

Could anyone look into this as soon as possible?

Awaiting for the reply

Regards,
Padmaja



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from

http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default Need Help Immediately

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column = 4 And Target.Row 1 Then
If Target.Offset(-1, 0) = "" Then Exit Sub
Target.FormulaR1C1 = Target.Offset(-1, 0).FormulaR1C1
End If
End Sub

HTH,
Merjet


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 176
Default Need Help Immediately

Merjet,

This event code is not triggered when a cell is inserted. The user
would need to de-select / re-select the cell to get it to work. It
would also insert a formula if the user selected the blank cell at the
bottom of the block of cells in column D.

HTH,
Bernie


"merjet" wrote in message
news:jQxhb.727948$uu5.123793@sccrnsc04...
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column = 4 And Target.Row 1 Then
If Target.Offset(-1, 0) = "" Then Exit Sub
Target.FormulaR1C1 = Target.Offset(-1, 0).FormulaR1C1
End If
End Sub

HTH,
Merjet




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default Need Help Immediately

This event code is not triggered when a cell is inserted.

I was guessing at what Padmaja wanted. I know what
"insert a row" or "insert a column" means, but not "insert
a cell".

Merjet




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default Need Help Immediately

Easy enough to find out what "insert a cell" does. Select any cell.
Select Insert | Cells...

--
Regards,

Tushar Mehta, MS MVP -- Excel
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article <qczhb.722037$Ho3.175570@sccrnsc03,
says...
This event code is not triggered when a cell is inserted.


I was guessing at what Padmaja wanted. I know what
"insert a row" or "insert a column" means, but not "insert
a cell".

Merjet



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
How do I make Control-Home go immediately to A1? Phyllis Excel Discussion (Misc queries) 1 September 17th 09 03:20 AM
Fill in Blanks with immediately above cell value Charles Excel Discussion (Misc queries) 4 May 15th 09 05:09 PM
Immediately jump to next cell? [email protected] Excel Discussion (Misc queries) 1 November 24th 05 09:51 PM
Workbook Unexpectedly Closes Immediately AD Excel Discussion (Misc queries) 0 January 31st 05 08:03 PM
Change cell value immediately after a save Bob Phillips[_5_] Excel Programming 0 August 8th 03 01:26 PM


All times are GMT +1. The time now is 06:14 PM.

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

About Us

"It's about Microsoft Excel"