View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 1,726
Default Macro: Updates a formula or value when a data is entered.

using made up formulae

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "A:A" '<== change to suit

On Error GoTo ws_exit
Application.EnableEvents = False

If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
If .Value = "" Then
.Offset(0, 15).Resize(1, 7).ClearContents
Else
'add formulae
.Offset(0, 15).FormulaR1C1 = "=RC[-15]"
'etc.
.Offset(0, 21).FormulaR1C1 = "=SUM(RC[-6]:RC[-1])"
End If
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click


--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


" wrote in
message ...
Please help!!! I have been trying to get the answer for this, a time too
many. I know its possible.

I have about 20,000 rows of data in Cell A2:A20001 to O2:O20001 and
growing.
I have formulas for each row in columns P to V.

How to use the macro to record when data is entered into cell A2 Cell
P2,Q2,R2,S2,T2,U2,V2 automatically updates a formula or value? And when
Cell
A2 is blank Cell P2-V2 is also blank.

Meaning, when data is entered in to any cell in column A, the same row of
P
to V automatically updates itself.

I have tried the Macro recorder, but the result is rather restricted to
what
has been done.

What I am trying to do is avoid copy or drag, but to automate.

The only thing I have now in my head is to copy or drag Cell Column P2 to
P65,536 : V2 to V65,536.

Thanks a billion!!!