VBA to copy a drop down list to the last used row but not the values in it.

justme101

Board Regular
Joined
Nov 18, 2017
Messages
67
Office Version
  1. 365
Platform
  1. Windows
Hi all,

Scenario: I have some data in a sheet, the data for which gets updated fairly regularly. The new data gets appended after the current last used row. I have a lot of formulae in various columns, and I can successfully copy and apply the all till the end of the data, after the data gets updated. The issue is with one column which as drop down list in the first cell (J10). It has 3 values in it, Yes, No and (blank).

Issue: when I use the following lines of code to get the lastrow and copy the drop down list till the last used row of data, it overwrites all the values in between, with whatever is in the 1st cell (J10). So, let's say value for J10 is manually set to No by the user, J11 is Yes, J12 is Yes, when I use this code, it populates every cell till the end with No.

Requirement: I need the VBA to just include the drop down list to newly added rows, where the drop down will not automatically come up. It should not overwrite any existing cells.

VBA Code:
Sub update_formula()

ThisWorkbook.Worksheets("Master Tracker").Activate

Dim lastrow3 As Long
Application.ScreenUpdating = False

lastrow3 = Range("A" & Rows.Count).End(xlUp).Row

Range("J10").Copy
Range("J10:J" & lastrow3).PasteSpecial xlPasteFormulas

End sub
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

Forum statistics

Threads
1,215,835
Messages
6,127,167
Members
449,368
Latest member
JayHo

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