PDA

View Full Version : Macro to tel user new data has been added



keilah
10-15-2007, 04:31 AM
Hi

Hi have the following macro first try, but it is not doing the below steps

here is the code

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, [A:A]) Is Nothing Then Exit Sub
Dim Cell As Range, msg As String
For Each Cell In Target
msg = msg & Cell & vbCrLf
Next
MsgBox msg
End Sub


Need the macro that will look in cloumn A, and if any new data or client name are added then inform the user that the following name have been added.......Via a pop up window or a meesage box....

Is it also possible to show the names of the new data that has been added........I am also assuming that the macro would need to re frsh the data before it tells the user of the new data....

the data i have given are fixed names.....and we can assume this as the starting point.

i need this macro to work everytime the sheet is opened up.....i am going to hide this sheet and the user will only be accessing this once a message pops up informing them that new data fields have been added...

lucas
10-15-2007, 07:06 AM
How will excel know if new data has been added? Were you planning to copy the existing data to a different sheet for comparison?

keilah
10-15-2007, 07:26 AM
Hi

I have a set range of data in A1:A396.....this is always fixed....my starting point.....

lucas
10-15-2007, 07:42 AM
So you basically want to look at cell A397 and return any data if it exists for that row and any below it?

keilah
10-15-2007, 08:00 AM
Yes.......in a nut shell...........would it help if i posted the workbook.....

keilah
10-15-2007, 08:02 AM
the workbook is attached

lucas
10-15-2007, 08:28 AM
Maybe something like this to get you started:
Sub a()
Dim LastRow As Object
Set LastRow = Sheet1.Range("A396:a65536").End(xlUp)
If LastRow.Offset(395, 0) = "" Then
Exit Sub
Else
MsgBox LastRow.Offset(395, 0).Value
End If
End Sub