View Single Post
  #19   Report Post  
Nadia
 
Posts: n/a
Default

I had a feeling that it would be rather complex. "you dont ask...you dont get!"
It was worth a shot, but I can live with it.
Thank you for all your time, effort and consideration

Nadia :-)

"Dave Peterson" wrote:

This kind of thing becomes a big old problem (in my mind, anyway).

I like to keep my "real" data in one spot and split it when I have to. Each of
the "splits" is a report only worksheet/workbook. If changes have to be made,
then you have to go back to the real source and make the changes and regenerate
the reports.

But you could have some equivalent code in each sheet that copy/move data over,
but man, oh, man, it can get really messy really fast. (You make a change with
an error in it. You have to find the place that received the error and clean it
up. And then reenter to fix the spot that should have gotten it.)

You add a record, but there's a record that corresponds to that record in the
other sheet. It shouldn't be added to--it should be replaced/updated.

I surely wouldn't do this--not as much for code problems--just standard human
problems.

Did I convince you not to do it?

Nadia wrote:

Hi guys,
is there a quick way to have the existing data update on the Summary sheet
when changes are made to the other 3 sheets?? At the moment it will recopy as
a new record.

"Dave Peterson" wrote:

I still would do all my typing (just for the sake of a quick validation check),
then copy the rows to the other sheets all at once.

Maybe you can steal some code from Debra Dalgleish's site:

There are a couple of files he

http://www.contextures.com/excelfiles.html

Create New Sheets from Filtered List -- uses an Advanced Filter to create
separate sheet of orders for each sales rep visible in a filtered list; macro
automates the filter. AdvFilterRepFiltered.xls 35 kb

Update Sheets from Master -- uses an Advanced Filter to send data from
Master sheet to individual worksheets -- replaces old data with current.
AdvFilterCity.xls 55 kb

But if you want...

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)

Dim destCell As Range
Dim testWks As Worksheet

'one cell at a time only!
If Target.Cells.Count 1 Then Exit Sub

'only check column J
If Intersect(Target, Me.Range("J:J")) Is Nothing Then Exit Sub

'and it can't be empty!
If IsEmpty(Target) Then Exit Sub

'Column A of the row must have data
If IsEmpty(Me.Cells(Target.Row, "A")) Then
MsgBox "Please put something in A" & Target.Row
Exit Sub
End If

Set testWks = Nothing
On Error Resume Next
Set testWks = Me.Parent.Worksheets(Target.Value)
On Error GoTo 0

If testWks Is Nothing Then
'doesn't match an existing worksheet
'it could mean that the worksheet is missing, too,
'but I'm guessing that it'll probably be a typo
MsgBox "Please fix the value in: " & Target.Address(0, 0)
Exit Sub
End If

With testWks
Set destCell = .Cells(.Rows.Count, "A").End(xlUp).Offset(1, 0)
End With

On Error GoTo errHandler:
Application.EnableEvents = False
Target.EntireRow.Resize(1, 9).Copy _
Destination:=destCell
Target.Value = "Copied"
Beep

errHandler:
Application.EnableEvents = True

End Sub

This actually allows any entry in column J and looks for a worksheet to match.
If that's a problem, the macro could be changed to only look for those 3
entries.





Andre Croteau wrote:

Hello Dave and Gord....this is great stuff!!

Might I ask a variation of this great application?

Suppose I have data in a master sheet, with data in cells A:I, with column J
with the name of 3 possible sheet names QLD, NSW, WA in the same workbook
I would like the data from the master sheet to go to their respective
individual sheets depending on the value of the cell entered in column J.

Thank you in advance.

André

"Dave Peterson" wrote in message
...
PMFJI,

the problem I have with stuff like this is that I don't know when to do
the
copy.

You could do the copy when you finish the entry in column I (whatever
finish
means!).

Or maybe use column J as an indicator. That would give you a chance to
correct
any typos in A:I without having go to the other sheet to fix it, too.

I'm gonna use column J, but you could use column I if you really want.

This works for me, but with my typing, I'm not sure if it would make my
job
easier or more difficult:

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)

Dim destCell As Range

'one cell at a time only!
If Target.Cells.Count 1 Then Exit Sub

'only check column J
If Intersect(Target, Me.Range("J:J")) Is Nothing Then Exit Sub

'and it can't be empty!
If IsEmpty(Target) Then Exit Sub

'Column A of the row must have data
If IsEmpty(Me.Cells(Target.Row, "A")) Then
MsgBox "Please put something in A" & Target.Row
Exit Sub
End If

With Worksheets("summary")
Set destCell = .Cells(.Rows.Count, "A").End(xlUp).Offset(1, 0)
End With

On Error GoTo errHandler:
Application.EnableEvents = False
Target.EntireRow.Resize(1, 9).Copy _
Destination:=destCell
Target.Value = "Copied"
Beep

errHandler:
Application.EnableEvents = True

End Sub

Nadia wrote:

Me AGAIN...
Ive copied and made changes to the IF statement so that data from A:I in
"sheet 1" also appears in the "Summary" sheet A:I... however, if one of
the
cells in "sheet 1" is blank the rest of the data jumps up 1 row in the
"summary" sheet.. how can I fix this.
cheers,
Nadia

"Nadia" wrote:

Hi Gord,
The code works great..... NOW... how can I amend this to get data from
more
than 1 cell on the same row to do the same, e.g. I want to type data
in
colums A:I.
many thanx


"Gord Dibben" wrote:

Andre

Stick this code in your 3 worksheets.

Private Sub Worksheet_Change(ByVal Target As Range)
''when entering data in a cell in Col A
On Error GoTo enditall
Application.EnableEvents = False
If Target.Cells.Column = 1 Then
n = Target.Row
If Excel.Range("A" & n).Value < "" Then
Excel.Range("A" & n).Copy Destination:= _
Sheets("Summary").Cells(Rows.Count, 1).End(xlUp) _
.Offset(1, 0)
End If
End If
enditall:
Application.EnableEvents = True
End Sub


Gord Dibben Excel MVP

On Wed, 15 Dec 2004 18:58:50 GMT, "Andre Croteau"

wrote:

Hello Frank,


I don't know about you Nadia, but I sure would like to know!

I still think these newsgroups are the best learning tool!!!., and
the best
thing since sliced bread!!

Thank you in advance!!!!! and Happy Holidays to all!

André


"Frank Kabel" wrote in message
...
Hi
this would be only possible using vBA event procedures (e.g.
worksheet
change event handlers). Do you want to go this way?

--
Regards
Frank Kabel
Frankfurt, Germany

Nadia wrote:
I would like to enter data into lists on 3 different sheets and
I
would like that data to automatically collate on a summary
sheet
(i.e. as soon as I hit enter after typing the data in one of
the 3
sheets it should appear on the summary sheet on the next
available
row).
Can this be done??






--

Dave Peterson

--

Dave Peterson


--

Dave Peterson