VBA to auto fill or allow data entry

Sarahj0630

New Member
Joined
Aug 14, 2012
Messages
11
I feel like this is fairly easy but for some reason (call it pregnancy brain) I can't get it to work. I have this checkbox to automate if the split is 50/50 and it automatically puts in the value into the MaxInvest (E9) and HorizonInvest (I7) fields. I also want to be able to manually enter in values those fields as well, in case the split is not 50/50. If a value is entered in either Investment cells, then it will automatically calculate what the other investment would be left with. I have it working if we change the MaxInvest but it wont work on the Horizon, it is like the formula is overriding itself. Thanks!

Private Sub CheckBox1_Click()


If CheckBox1.Value = True Then ThisWorkbook.Sheets("Barbell Strategy").Range("E9, I7").Value = Range("Fifty")
If CheckBox1.Value = False Then ThisWorkbook.Sheets("Barbell Strategy").Range("E9, I7").ClearContents

End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)


If Range("E9").Value <> Range("Fifty").Value Then Range("I7") = Range("J7").Value
If Range("I7").Value <> Range("Fifty").Value Then Range("E9") = Range("F9").Value

End Sub
 

Attachments

  • Screenshot 2020-10-27 155931.jpg
    Screenshot 2020-10-27 155931.jpg
    56.2 KB · Views: 1

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.

Forum statistics

Threads
1,214,919
Messages
6,122,260
Members
449,075
Latest member
staticfluids

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