VBA to Retrieve and Insert Cell Value

happyhungarian

Active Member
Joined
Jul 19, 2011
Messages
252
Office Version
  1. 365
Platform
  1. Windows
Hi,

I have a range of cells (let's say cells D2:H2) that can either be formula-driven or user-inputs. In cells D1:H1 there are drop downs that determine the type of formula that should be used if a formula is chosen over user inputs. I can't simply use an IF formula in D2:H2 because a user could simply input cells and overwrite the IF formula. What I would like is to have a code that would say if D1 = OR("Formula1","Formula2") then retrieve the value in another cell (let's say D10) and insert it into D2. Row "10" is where I would have my IF formula. Hope that makes sense!

Thanks,

Jesse
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
There are obviously issues with this code but I was thinking of something along these lines:



Private Sub Worksheet_Change(ByVal Target As Range)


If Not Intersect(Target, Range("F3")) Is Nothing Then
If ActiveSheet.Range("F3").Value <> "Given Values" Then
Range("F77").Formula = Range("F16").Formula
End If
End Sub


It's basically saying that if the value in F3 changes and the new value does not equal "Given Values" then copy the exact formula that's in cell F77 and place it into cell F16
 
Upvote 0

Forum statistics

Threads
1,215,053
Messages
6,122,888
Members
449,097
Latest member
dbomb1414

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