Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I make Control-Home go immediately to A1? | Excel Discussion (Misc queries) | |||
Fill in Blanks with immediately above cell value | Excel Discussion (Misc queries) | |||
Immediately jump to next cell? | Excel Discussion (Misc queries) | |||
Workbook Unexpectedly Closes Immediately | Excel Discussion (Misc queries) | |||
Change cell value immediately after a save | Excel Programming |