+ Reply to Thread
Results 1 to 6 of 6

On cell change, submit data to another sheet

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    02-12-2018
    Location
    Clearwater, FL
    MS-Off Ver
    MS 365
    Posts
    217

    On cell change, submit data to another sheet

    I have a sheet called "Control" where I want to put the date in cell "M12" & when I move out of cell it copies that date to the cell on sheet "Escalation Rotation" beside the name of the associate that was beside "M12" in "Control". I have included my workbook so you can see what needs to be done. Any help would be greatly appricaited!!!
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    01-03-2018
    Location
    Fukuoka, Japan
    MS-Off Ver
    Excel 2013
    Posts
    123

    Re: On cell change, submit data to another sheet

    Here's a worksheet procedure for "Control". The macro runs when the value in cell "M12" is changed.

    Private Sub Worksheet_Change(ByVal Target As Range)
        If Intersect(Target, Range("M12")) Is Nothing Then Exit Sub
        
        If IsDate(Target.Value) Then
            Dim found As Range
            Dim firstFound As Range
            
            With Sheets("Escalation Rotation").Range("A:A")
                Set found = .Find(What:=Range("I12"), LookAt:=xlWhole)
                If Not found Is Nothing Then
                    found.Offset(, 1) = Target.Value
                    Set firstFound = found
                    Do
                        Set found = .FindNext(found)
                        If Not found Is Nothing Then
                            found.Offset(, 1) = Target.Value
                        End If
                    Loop Until found.Address = firstFound.Address
                End If
            End With
        End If
    End Sub

  3. #3
    Forum Contributor
    Join Date
    02-12-2018
    Location
    Clearwater, FL
    MS-Off Ver
    MS 365
    Posts
    217
    Quote Originally Posted by yujin View Post
    Here's a worksheet procedure for "Control". The macro runs when the value in cell "M12" is changed.

    Private Sub Worksheet_Change(ByVal Target As Range)
        If Intersect(Target, Range("M12")) Is Nothing Then Exit Sub
        
        If IsDate(Target.Value) Then
            Dim found As Range
            Dim firstFound As Range
            
            With Sheets("Escalation Rotation").Range("A:A")
                Set found = .Find(What:=Range("I12"), LookAt:=xlWhole)
                If Not found Is Nothing Then
                    found.Offset(, 1) = Target.Value
                    Set firstFound = found
                    Do
                        Set found = .FindNext(found)
                        If Not found Is Nothing Then
                            found.Offset(, 1) = Target.Value
                        End If
                    Loop Until found.Address = firstFound.Address
                End If
            End With
        End If
    End Sub
    Would I be able to set the range from M12 to M16?

  4. #4
    Forum Contributor
    Join Date
    01-03-2018
    Location
    Fukuoka, Japan
    MS-Off Ver
    Excel 2013
    Posts
    123

    Re: On cell change, submit data to another sheet

    Would I be able to set the range from M12 to M16?
    OK, voila!

    Private Sub Worksheet_Change(ByVal target As Range)
        If Intersect(target, Range("M12:M16")) Is Nothing Then Exit Sub
        
        If IsDate(target.Value) Then
            Dim found As Range
            Dim firstFound As Range
            
            With Sheets("Escalation Rotation").Range("A:A")
                Set found = .Find(What:=target.Offset(, -4).Value, LookAt:=xlWhole)
                If Not found Is Nothing Then
                    found.Offset(, 1) = target.Value
                    Set firstFound = found
                    Do
                        Set found = .FindNext(found)
                        If Not found Is Nothing Then
                            found.Offset(, 1) = target.Value
                        End If
                    Loop Until found.Address = firstFound.Address
                End If
            End With
        End If
    End Sub

  5. #5
    Forum Contributor
    Join Date
    02-12-2018
    Location
    Clearwater, FL
    MS-Off Ver
    MS 365
    Posts
    217

    Re: On cell change, submit data to another sheet

    Ok so this does similar to what I need! When it copies the date over to "Escalation Rotation" sheet, it copies the date all the way down, I need it to find the 1st blank cell and put that date in. Then once it is copies over, I need the contents in cells "M12:M16" cleared ready for the next date that is put in for a different associate! Thank you for your help!

  6. #6
    Forum Contributor
    Join Date
    01-03-2018
    Location
    Fukuoka, Japan
    MS-Off Ver
    Excel 2013
    Posts
    123

    Re: On cell change, submit data to another sheet

    Here I have modified the code. Try it.

    Private Sub Worksheet_Change(ByVal target As Range)
        If Intersect(target, Range("M12:M16")) Is Nothing Then Exit Sub
        
        If IsDate(target.Value) Then
            Dim found As Range
            Dim firstFound As Range
            
            With Sheets("Escalation Rotation").Range("A:A")
                Set found = .Find(What:=target.Offset(, -4).Value, LookAt:=xlWhole)
                If Not found Is Nothing Then
                    If IsEmpty(found.Offset(, 1)) Then
                        found.Offset(, 1) = target.Value
                    Else
                        Set firstFound = found
                        Do
                            Set found = .FindNext(found)
                            If Not found Is Nothing Then
                                If IsEmpty(found.Offset(, 1)) Then
                                    found.Offset(, 1) = target.Value
                                    Exit Do
                                End If
                            End If
                        Loop Until found.Address = firstFound.Address
                    End If
                End If
            End With
            
            Range("M12:N16").ClearContents
            Range("M12:N12").Select
        End If
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Submit date on cell change vba
    By Jamesraywebber85 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-18-2018, 03:57 PM
  2. Submit Form w/Button & Data Management Sheet
    By lampe2007 in forum Excel General
    Replies: 1
    Last Post: 01-30-2015, 06:28 PM
  3. how to submit a data in excel vba in different workbook or sheet
    By UAZHAR in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-11-2013, 04:40 AM
  4. Replies: 1
    Last Post: 06-20-2013, 06:05 PM
  5. Transfering data from one sheet to a master sheet using Submit (command button)
    By readitdaily in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-02-2013, 09:15 AM
  6. [SOLVED] How to: copy data from sheet 1 to 2 after hitting a submit button?
    By WillGe in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-12-2012, 01:29 AM
  7. Transfering Data from one sheet to another using a 'submit' button
    By vjsmith10 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-18-2009, 06:29 AM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1