Consulting

Results 1 to 7 of 7

Thread: Macro to tel user new data has been added

  1. #1
    VBAX Contributor
    Joined
    Aug 2007
    Posts
    165
    Location

    Macro to tel user new data has been added

    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...

  2. #2
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    How will excel know if new data has been added? Were you planning to copy the existing data to a different sheet for comparison?
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  3. #3
    VBAX Contributor
    Joined
    Aug 2007
    Posts
    165
    Location
    Hi

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

  4. #4
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    So you basically want to look at cell A397 and return any data if it exists for that row and any below it?
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  5. #5
    VBAX Contributor
    Joined
    Aug 2007
    Posts
    165
    Location
    Yes.......in a nut shell...........would it help if i posted the workbook.....

  6. #6
    VBAX Contributor
    Joined
    Aug 2007
    Posts
    165
    Location
    the workbook is attached

  7. #7
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    Maybe something like this to get you started:
    [VBA]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[/VBA]
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •