New Excel Forum

This forum has been moved to TeachExcel.com

Ask all future questions in the New Excel Forum.

ExcelKey

Option Box - Constant Updating

Macros, VBA, Excel Automation, etc.

Option Box - Constant Updating

Postby bjarvis » Mon Mar 07, 2016 11:39 pm

Hello,

Firstly want to apologise - after years of using formulas, I've only started using (or attempting) to use macros for the first time a few days ago, so my explanations may be a little rusty, but I'll do my best.

I'm creating a form in Excel, for relocations of a device.

The form has 4 Option Buttons (ActiveX Control) in 2 categories - 2 YES and 2 NO buttons in total.

For 1 of the categories, I'm asking the customer I'm asking the customer, if they require Same Day Delivery, with the date of collection asked earlier in the form.

If they state YES using the Option Button, Cell D24 populates the same date listed earlier in Cell D17 (for the collection). This works fine. However, if the date is then updated in Cell D17, the date/data in Cell D24 does not automatically update with these changes. You have to press the "NO" button to clear Cell D24, and then press the "YES" button, to repopulate the accurate information from D17.

The code used is:

Code: Select all
Private Sub YES_Date_Click()
   If Sheets("Mancourt Form").YES_Date.Value = True Then
    Range("D24").Value = Range("D17").Value
    End If
End Sub


Any help would be greatly appreciated. Thank you.
  • 0

bjarvis
Rookie
 
Posts: 1
Joined: Mar 7, 2016
Reputation: 0
Excel Version: Office 2010

Re: Option Box - Constant Updating

Postby NoSparks » Tue Mar 08, 2016 9:56 am

Perhaps something like this ?

Code: Select all
Private Sub YES_Date_Click()
  If Sheets("Mancourt Form").YES_Date.Value = True Then
    Range("D24").Formula = "=D17"
  Else
    Range("D24").Value = ""
  End If
End Sub
  • 0

NoSparks
Excel Hobbyist
 
Posts: 637
Joined: May 28, 2014
Reputation: 103
Excel Version: 2010


Return to Macros and VBA Questions

Who is online

Users browsing this forum: No registered users and 24 guests