Sep 20 2019 10:52 AM
Sep 21 2019 12:01 AM - edited Sep 21 2019 07:48 AM
I do not think this can be done with a formula, because a conditional formula returns a value but not a selection.
However it could be done by a code in VBA. Also you need to decide how would you like to run that code: Is it manually? or with the opening event of the workbook or with the change happening to a cell you specify?
I need more details or better a sample file to do it properly.
The concept is as follows
ALT + F11 >> opens the VB editor
ALT + I + M >> creates a module
then type:
Sub Evaluate()
If Range("A3"). value <> "" Then
Range("A4"). select
ActiveCell.value= Sheets("Invoice").Range("A13").value
End If
End Sub
Hope that helps
Nabil Mourad
Sep 21 2019 07:47 AM
Hi again
In my answer I focused on "SELECTING" the cell below assuming that you want this cell to be selected.
However if "Selecting A4" is not a must then, without a doubt go with the nice formula provided by our team mate @Subodh_Tiwari_sktneer
Thank you
Nabil Mourad
Sep 21 2019 08:28 AM
Sep 21 2019 08:36 AM
Sep 21 2019 08:57 AM - edited Sep 21 2019 09:05 AM
Hi
To run the code whenever A13 changes in the Invoice worksheet, then
You need to attach the code to cell A13 Change event:
To do that,
Right click the worksheet Tab (Invoice) >> select view code
In the VB Editor, you have 2 drop lists, from the left one select "Worksheet" from the Right one select "Change"
Then write the code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = Range("A13").Address Then
Call Evaluate
End If
End Sub
If you want to check if a cell is empty then proceed to the cell below without overwriting, that requires modifying the Evaluate code and let it loop before copying.
Sep 21 2019 10:05 AM
SolutionBased 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.
Sep 21 2019 10:18 AM
Sep 21 2019 11:28 AM
Sep 21 2019 07:23 PM
You're welcome! Glad it worked as desired.
Please take a minute to accept the post with proposed solution which resolved the issue as an Answer to mark your question as Solved.
Sep 22 2019 11:37 AM
Same here. I have never asked any question here so not aware of how to accept a post as an answer.
But it seems you will find a button called Mark as Best Response next to Like button under a post.
Refer to the following image and see if that's the case. :)
Sep 23 2019 06:24 AM
Sep 23 2019 06:30 AM
Can you please share the Change Event Code you finally have on Sheet Module?
And then explain what it does and what do you expect it to do actually?
Sep 24 2019 07:46 AM
Sep 24 2019 08:05 AM
See if this is what you are trying to achieve. Pay attention to the comments added in the code and tweak it as per your requirement.
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
'Changing A13 on Invoice sheet will copy A13 to the Tracking in the first empty cell after the last row with data in Column A
If Target.Address(0, 0) = "A13" Then
If Target <> "" Then
Target.Copy wsDest.Range("A" & Rows.Count).End(3)(2)
End If
'Changing C2 on Invoice sheet will copy C2 to the Tracking in the first empty cell after the last row with data in Column C
ElseIf Target.Address(0, 0) = "C2" Then
If Target <> "" Then
Target.Copy wsDest.Range("C" & Rows.Count).End(3)(2)
End If
'Changing D2 on Invoice sheet will copy D2 to the Tracking in the first empty cell after the last row with data in Column D
ElseIf Target.Address(0, 0) = "D2" Then
If Target <> "" Then
Target.Copy wsDest.Range("D" & Rows.Count).End(3)(2)
End If
'Changing E2 on Invoice sheet will copy E2 to the Tracking in the first empty cell after the last row with data in Column E
ElseIf Target.Address(0, 0) = "E2" Then
If Target <> "" Then
Target.Copy wsDest.Range("E" & Rows.Count).End(3)(2)
End If
End If
End Sub
Sep 24 2019 09:42 AM
Sep 24 2019 10:42 AM
That's difficult to answer why it isn't working. Do you change D35 manually? The point to remember here is that the Change Event Code will only be triggered automatically when you change the content of the cells manually not if the content is changed through formulas.
Sep 21 2019 10:05 AM
SolutionBased 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.