Populating a cell with a formula based on drop down "action"

kanderna

New Member
Joined
Dec 14, 2006
Messages
11
I have a sheet where the user makes a selection from a drop-down menu. A cell (where I currently have a VLOOKUP), then auto-populates with a rate based on what they selected in the drop-down. All works fine and good, but here's where my question comes in. The rate that is autopopulated is a starting point. I want to user to be able to tweak the rate up or down as they see fit. The problem with that is once they tweak, the VLOOKUP formula is gone.

My question is... is there a way to replace the formula (or at least the value behind the VLOOKUP) whenever a new selection is made from the drop-down (and perhaps when they open the file)?

Excel 2013. Thanks!
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
I think I got it. This seemed to do what I want:

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("B2:B9")) Is Nothing Then
Range("B10").Select
ActiveCell.Formula = "=VLOOKUP(B2,D5:I9,MATCH(B9,D4:I4,0),FALSE)"
End If

End Sub
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

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