Avatar of wlwebb
Flag for United States of America asked on

Userform Textbox with date adjusted by worksheet cell

I have an Excel 2007 workbook where I have created a Userform.  On that Userform the clerk will select a date from a Calendar Control.  That selected date then populates textbox tbDateEnd with the following

(Note-This code works)
Private Sub Calendar1_Click()
    ActiveCell.NumberFormat = "m/d/yyyy"
    tbDateEnding.Value = Calendar1.Value
    Sheets("History Detail").Range("DateEndingInput").Value = Calendar1.Value
End Sub

Open in new window

This following is what I can't get to work

I have a second textbox where I want the deliver date to be calculated and recorded.  The deliver date lead time is a named range on worksheet "Company Data"  That name is "LeadTimeDaysAdjustment" and is a formula that returns a number (example say 7).

What I am trying to do is when the clerk clicks the calendar control it populates that tbDateEnding (which it currently does) and then populates the "tbDeliverDate" with the tbDateEnding + the LeadTimeDaysAdjustment

Here is the code I used for that:
Private Sub tbDateEnding_Change()
    DaysAdjust.Value = Worksheets("Company Data").Range("LeadTimeDaysAdjustment").Value
    ActiveCell.NumberFormat = "m/d/yyyy"
    tbDateEnding.Value = (tbDateEnding.Value + DaysAdjust.Value)
End Sub

Open in new window

It does not work.
Microsoft Excel

Avatar of undefined
Last Comment

8/22/2022 - Mon
Arno Koster

can you try
tbDeliverDate.Value = (Calendar1.Value + DaysAdjust.Value)
Arno Koster

tbDeliverDate.Value = (tbDateEnding.Value + DaysAdjust.Value)

Open in new window

should work as well

I keep getting "Object Required" as an Error when it hits the DaysAdjust.Value = Worksheets...........
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question

Thanks.  Worked when I fixed that issue