LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 114
Default Macro: Updates a formula or value when a data is entered.

In the diagram below, Column A to D represents DATA like (key in)

A: Date
B: Document Number
C: Sales Person
D: Amount

Column E to G represents FORMULA like
E: Vlookup / Index Match
F: SumIF
G: + - x /

Sheet 1
------------Data-------------+---Formula-----Column
-----A-----B-----C-----D-----E-----F-----G
1---
2---
3---
4---
5---
6---
7---
8---
9---
Row

Current Method:
Lets say the FORMULA row is only up to E3 after the latest access (3 rows of
data). And after some data entry the DATA line it reaches Row 9.

What I will do is copy / drag E3:G3 downwards to row 9 and the formula is
pegged for each line. (Manual)

I use lots of Pivot Table. The structure of the source data is as per
diagram. One row to contain all information.

When your codes contain R1C1, that is beyond my ability.

Your codes do automate, however its a little tough! I guess I am using
surface functions to steer IN the VBA (that deserves a kick in the ***) Thats
why I have lots of hard code and long formulas!

For the Len thing: Copy and Paste !!! (extracted from the script below)

The VBA script below is for fixed cell but it does not automatically peg a
data line. (Acquired earlier)

Private Sub Worksheet_Change(ByVal Target As Excel.Range)

If Target.Cells.Count 1 Then Exit Sub
If Len(Target.Value) 0 Then Exit Sub

Application.EnableEvents = False

If Target.Address = "$E$6" Then Target.Formula= "=YEAR(TODAY())"

If Target.Address = "$F$6" Then Target.Formula=
"=SUMIF('31'!S:S,CONCATENATE(G6,""-"",L6),'31'!H:H)"

If Target.Address = "$G$6" Then Target.Formula=
"=IF(ISERROR(LEFT(INDEX('31'!L:L,MATCH(CONCATENATE (G6,""-"",L6),'31'!S:S,0)),SEARCH(""-"",INDEX('31'!L:L,MATCH(CONCATENATE(G6,""-"",L6),'31'!S:S,0)))-1)),"""",LEFT(INDEX('31'!L:L,MATCH(CONCATENATE(G6, ""-"",L6),'31'!S:S,0)),SEARCH(""-"",INDEX('31'!L:L,MATCH(CONCATENATE(G6,""-"",L6),'31'!S:S,0)))-1))

Trial & error!!!!

Hey Bob, thanks ! Appreciate your effort and time. I will use the codes you
have given me.



 
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
macro unouwanme Excel Discussion (Misc queries) 9 August 31st 06 09:38 PM
error when running cut & paste macro Otto Moehrbach Excel Worksheet Functions 4 August 9th 06 01:49 PM
CAE macro for green screen updates with Excel data Sriram Excel Discussion (Misc queries) 1 July 16th 06 04:19 PM
Macro question Chris Excel Worksheet Functions 12 July 7th 06 01:23 AM
Excel Macro to Copy & Paste [email protected] Excel Worksheet Functions 0 December 1st 05 01:56 PM


All times are GMT +1. The time now is 10:02 AM.

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"