Forum Discussion

Jtandme's avatar
Jtandme
Copper Contributor
Sep 20, 2019
Solved

Formula

I am needing a formula that will check cell a3 if has data go down to next cell, then copy the data from another worksheet called invoice and the cell is a13.
  • Subodh_Tiwari_sktneer's avatar
    Sep 21, 2019

    Jtandme 

    Based on your description, assuming you have two sheets called "Tracking" and "Invoice" and if you want to copy the cell A13 on Invoice Sheet if changed to the first empty cell after the last row with data in column A on Tracking Sheet, place the following code on the Invoice Sheet Module.

     

    To do so, right click on Invoice Sheet Tab --> View Code and paste the code given below into the opened code window and save your workbook as Macro-Enabled Workbook.

     

    If name of your tracking sheet is not "Tracking", change the name of tracking sheet it in the code.

     

    Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.CountLarge > 1 Then Exit Sub
    Dim wsDest  As Worksheet
    
    Set wsDest = Worksheets("Tracking")     'Assuming Tracking is the name of the Tracking Sheet, change it as required
    
    If Target.Address(0, 0) = "A13" Then
        If Target <> "" Then
            Target.Copy wsDest.Range("A" & Rows.Count).End(3)(2)
        End If
    End If
    End Sub

     

    Let me know if this is what you were trying to achieve.

Resources