Automatic Macro to copy/past information when drop down value selected

mikev2530

New Member
Joined
Jun 4, 2015
Messages
1
I have a simple feature that I need to add to my Excel workbook:

I have two worksheets (“Prospects” and “Call Log”) each with "Company Name" and "Phone Number" columns. The first worksheet (“Prospects”) is used to identify sales prospects, and the second worksheet ("Call Log") tracks actual calls placed to those companies. On the "Prospects" worksheet, I have a “Called” column with drop down boxes for "N" and "Y" (default set to “N”). When “Y” is selected from the drop down box, a Macro copies the "Company Name" and "Phone Number" values for that row and pastes them into the corresponding row/cells ("Company Name" and "Phone Number") in the “Call Log” worksheet. (This is a simple shortcut to avoid manually entering company name/phone twice). The Macro also enters the current date and time on the “Call Log” worksheet and ends by selecting a cell on the same row for manual data entry by the sales person.

My problem is that I have my Macro defined for only one specific drop down box ("D6:E6") and corresponding row (“6”) for both worksheets. How do I create a Macro that will be universal for every drop down box and row, whereby changing the value from “N” to “Y” will automatically copy the company name/phone for that row in “Prospects” and paste it into the corresponding row/cells in “Call Log”?

Here’s my Macro:

Sub Macro1()
'
' Macro1 Macro
'

'
Range("D6:E6").Select
Selection.Copy
Sheets("Call Log").Select
Range("D6:E6").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("A6").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=NOW()"
Range("C6").Select
ActiveCell.FormulaR1C1 = "=NOW()"
Range("F6").Select
End Sub

Here's my VB script that automatically runs the Macro when "Y" is selected from the drop down box in row 6 of the "Prospects" worksheet:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address(False, False) = "F6" And Target.Value = "Y" Then
Call Macro1
End If
End Sub

Obviously, this will also need to be modified so that it is universal, such that whenever a drop down box is changed to "Y" in "Prospects", the Macro automatically runs and copies the company name/phone for that row into the corresponding row/cells in "Call Log."

THANK YOU FOR YOUR HELP!
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).

Forum statistics

Threads
1,215,013
Messages
6,122,690
Members
449,092
Latest member
snoom82

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top