+ Reply to Thread
Results 1 to 24 of 24

CellValue = TextBox6 + TextBox4(*7) VBA

  1. #1
    Forum Contributor
    Join Date
    03-29-2012
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    818

    CellValue = TextBox6 + TextBox4(*7) VBA

    Good day,
    I am looking to find the following code to multiply (always by 7) the final Value that will be inserted in a Cell.
    I have 3 Textboxes.

    TextBox6 = Calendar Date (YYYY/MM/DD).Value (Ex: 2013/08/11) I have a popup Calendar in this Textbox.
    TextBox3 = OnlyNumbers
    TextBox4 = OnlyNumbers (Need to be multiplied by 7) Ex: TextBox4.Value & *7 but not until the final transfer (Cell Transfer)

    If the user adds a number in TextBox3 then
    Please Login or Register  to view this content.
    Ex: Date in textbox6 = 2013/08/11 and that TextBox3 = 2 then the cell value will equals to 2013/08/13

    I need that when a User adds a number to TextBox4 to make TextBox4 = the Value + *7

    Example: If the user adds 1 in textbox4 the final result that will be inserted in my new row in Column V is the following...(Date 2013/08/11)

    Please Login or Register  to view this content.
    Therefore will equal too... 2013/08/18 when I select my “Add cmdbutton”

    Would someone have a code or to explain who to add mutlyplied value to my textbox?

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: CellValue = TextBox6 + TextBox4(*7) VBA

    If TextBox4.Value is just a number remove DateValue around TextBox4.Value*7.

    Mutliplyng by 7 will convert the 'text' number in TextBox4 to a 'real' number.
    If posting code please use code tags, see here.

  3. #3
    Forum Contributor
    Join Date
    03-29-2012
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    818

    Re: CellValue = TextBox6 + TextBox4(*7) VBA

    So it should be...

    Please Login or Register  to view this content.
    Gives me an type error...


    Not very good when it comes to Textboxes...

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: CellValue = TextBox6 + TextBox4(*7) VBA

    What exactly is in TextBox4 when you get the error?

    Can you upload an example workbook?

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    PS You can lose the brackets.

  5. #5
    Forum Contributor
    Join Date
    03-29-2012
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    818

    Re: CellValue = TextBox6 + TextBox4(*7) VBA

    WLRTestdata.xlsm

    Here is the document...

    Double click A5 and select "Option" then select any from the drop down...
    Select (Yes) from the next question...
    Select (Yes) to the next question... A user form will ask you to add some info... I need to get the Delivery Date to add the Textbox4 number (Textbox4 needs to be *7 but only at transfer)

    So just add any information in the requested field... So when the User adds (example) 1 to the textbox4 then when the user selects "Add" then it will grab Textbox6 (Date) (Example 2013/08/11) and add textbox4 but Textbox4 should equal the original value from textbox4 (1) and multiply by *7 therefore making it 7.

    The cell value will show that following: 2013/08/18

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: CellValue = TextBox6 + TextBox4(*7) VBA

    When I (double) click A5 a form appears with an Options button, but no dropdowns.

    If I click the Options button another form appears with various buttons, and still no dropdowns.

    Have I missed something I should have done?
    Last edited by Norie; 08-12-2013 at 10:22 AM.

  7. #7
    Forum Contributor
    Join Date
    03-29-2012
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    818

    Re: CellValue = TextBox6 + TextBox4(*7) VBA

    Sorry here is the process:

    Double Click A5
    Select "Options"
    Select "Termination"
    Select anything from the dropdown menu
    Question1 = Yes
    Question2 = Yes

    UserForm:
    Add 1 to the first textbox
    Add 1 to the "Delivery Weeks"
    Add "1" to the "Contract Value"
    Add a date to the "Award Date"

    If you look in the VBE it will be under the frmtermination UserForm.

    I need when the user Select "Add" to add the following

    Cells(ActiveCell.Row + 1, "V").Value = DateAdd("d", TextBox6.Value + (TextBox4.Value * 7)) or well the good code.

  8. #8
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: CellValue = TextBox6 + TextBox4(*7) VBA

    Tried that but I get an 'Object required...' error.

    It highlights this piece of code.
    Please Login or Register  to view this content.
    I don't see a form name frmne, but I understand you might have removed that.

    It might be easier if you can tell us what's in the textboxes when you get the error.

    Also, what's meant to happen, eg what's to be added to what.

  9. #9
    Forum Contributor
    Join Date
    03-29-2012
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    818

    Re: CellValue = TextBox6 + TextBox4(*7) VBA

    Yes the frmne is another UserForm the workbook overall is around 530 KB without information.

    Error: Argrument not optional and it highlight's "DateAdd" from DateAdd("d", TextBox6.Value, (TextBox4.Value *7))

    Well I am not done with all the codes but

    Please Login or Register  to view this content.
    TextBox1 = number
    TextBox2 = Text
    TextBox3 or TextBox4 = Numbers (iether or as code is already inserted in Form you can only choose one or the other)
    TextBox5 = number that will convert to currency $
    TextBox6 = Popup Calendar that imputs the date in Textbox6

    Once the user as inputed, all, or all of the mandatory fields they will select "Add" and it will populate Worksheet "Report"

    The only problem is that TextBox4 needs to be multiplied by 7 (the user will add a number based on the time frame and not the dated) Example Delivery 2 Weeks therefore the number x 7 from the delivery date.

    if the user selects 2013/08/11 from the calendar that will be inserted in TextBox6 then when the code runs it will take the date from the textbox6 + the number from TextBox4(while muliplying textbox4 by 7) and add the final result in Cells(ActiveCell.Row + 1, "V").Value.

    Hope this helps

  10. #10
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: CellValue = TextBox6 + TextBox4(*7) VBA

    Hi Excelnoub


    I think you have two issues (at least) going on. The argument for "DateAdd" is
    Please Login or Register  to view this content.
    So, in your Code it becomes
    Please Login or Register  to view this content.
    However, this change causes other issues.

    Second issue...in frmCalendar2 and frmCalendar3 you have this Code that refers to Calendar1
    Please Login or Register  to view this content.
    Still trying to sort this all out...look up this alley...you know your Project and what you're trying to do...these are the things I see at the moment...will continue to look.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  11. #11
    Forum Contributor
    Join Date
    03-29-2012
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    818

    Re: CellValue = TextBox6 + TextBox4(*7) VBA

    Thank you Jaslake, Second issue...

    Well I can't figure out how to use only one calendar to add dates to my userform therefore I created 3, one for the worksheets and 2 for the userforms I am using. I have around 30 Userform and I need to input the dates in these userform (TextBox) so i guess this technique works good for me.

    Started this project with a total different aproach when a buddy told me to go with Userforms. Kind of works better for me using his method and plus more option can be added to a UserForm.

    I have something simillar with what I am trying to do.

    In another sheet, not included in the document above, I have the same textboxes but not the *7 as I have converted the *7 to a formula:

    Please Login or Register  to view this content.
    So that everytime a user adds a number in ActiveCell.Row, "F"; Cell G add "=F5*7 to cell G

    In
    HTML Code: 
    it will automatically calculate the Date in Cell I then add the number that is in cell E making the cell Add the Date + Number /or If the user adds a number in Cell F it will grab the date in Cell I and add the amount from Cell F That was automaticaly changed because of the Formula.

    I know it's kind hard to explain but I am trying to make the same but by bypassing the adding an extra column as it will take me hours / days to fix my workbook.

  12. #12
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: CellValue = TextBox6 + TextBox4(*7) VBA

    30 userforms?

    That just doesn't seem right.

    What do these forms do?

  13. #13
    Forum Contributor
    Join Date
    03-29-2012
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    818

    Re: CellValue = TextBox6 + TextBox4(*7) VBA

    Lol they make sure my users don't panic...
    5 user form to control my worksheets and the rest are small user form for selections and data selections.
    I am trying to make my workbook as userfriendly as possible.

  14. #14
    Forum Contributor
    Join Date
    03-29-2012
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    818

    Re: CellValue = TextBox6 + TextBox4(*7) VBA

    Instead of using msgbox with low selections I make them user forms therefore I can add my own tittle and function.
    I can try to upload my full workbook with some stuff deleted but I am afraid it will be to big.

  15. #15
    Forum Contributor
    Join Date
    03-29-2012
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    818

    Re: CellValue = TextBox6 + TextBox4(*7) VBA

    WLRTestdata.xlsm


    This is the full workbook...Keep in mind that some code will not work ie: Clean up Workload, from the main openworkbook
    I hope this works... It is not completed.

  16. #16
    Forum Contributor
    Join Date
    03-29-2012
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    818

    Re: CellValue = TextBox6 + TextBox4(*7) VBA

    To explain the process, it would be too long but if someone need a better undertanding please let me know.

    Note: This Workbook is mostly based on double_click field.

  17. #17
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: CellValue = TextBox6 + TextBox4(*7) VBA

    Why are there multiple calendar forms?

    Couldn't one calendar form be used whenever you require a date to be entered?

    Why do you have three forms for termination?

    Couldn't you have one form with a combobox for the type of termination, checkboxes (or option buttons) for legal contacted and new contract required.

    Also, why do you have forms that only appear to be for the input of one piece of data?

  18. #18
    Forum Contributor
    Join Date
    03-29-2012
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    818

    Re: CellValue = TextBox6 + TextBox4(*7) VBA

    I read up that is was complicated to have only one Calendar Form if you will have multiple userform and multiple date entries. I figured that it would be easier for me to establish this type of method.

    Instead of making them msgbox as it may change in the future…I decided to incorporate them in userforms… I will be the only one playing around with VBA codes therefore less complicated for me to change something an understand myself… I am not a VBA guru

    The way this workbook is made…it’s by process of what we have in-house. We have a dinosaur system and I wanted to make a replica in excel of what is the step by step… My ideas were limited lol

    This system has a lot of pop up windows and all but it was better this way so that the user that are not excel proof some never used excel before so yeah…I tried to make this as bullet proof possible.

    As I said, this is not complete and when I come up with a better approach I will definitely change the VB code for sure… but now I am only looking for the basic but yet complicated code.

  19. #19
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: CellValue = TextBox6 + TextBox4(*7) VBA

    Have you asked the users if they would prefer to have a whole bunch of pop-ups like your 'dinosuar' system or a one-stop form where they could enter all the required information, review it and then submit it?

    As for it being complicated to have one calendar form, I really don't see how that would be the case.

    Having multiple calendar forms is bound to complicate things.

  20. #20
    Forum Contributor
    Join Date
    03-29-2012
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    818

    Re: CellValue = TextBox6 + TextBox4(*7) VBA

    Yes the user prefers to be prompt with all those questions… Don’t get me wrong, I only take the users request in this…

    The more complicated code was kind of a mirror image of what the other system does. But the questions and the Userform for the one entry only were all them… So I tried to do with what I had. Like the double click instead of having a validation List, User said they were at ease with this type of method…Double click I mean.

  21. #21
    Forum Contributor
    Join Date
    03-29-2012
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    818

    Re: CellValue = TextBox6 + TextBox4(*7) VBA

    I guess I'll try another approach

  22. #22
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: CellValue = TextBox6 + TextBox4(*7) VBA

    Hi Excelnoub

    I'll look at it for a bit...see if I can figure out what's happening...it might take a while...
    This Code does not work...you already know that
    Please Login or Register  to view this content.
    This Code does work...I tested it
    Please Login or Register  to view this content.
    This Process now works if you change the above line of Code
    Select "Options"
    Select "Termination"
    Select anything from the dropdown menu
    Question1 = Yes
    Question2 = Yes

    UserForm:
    Add 1 to the first textbox
    Add 1 to the "Delivery Weeks"
    Add "1" to the "Contract Value"
    Add a date to the "Award Date"

    If you look in the VBE it will be under the frmtermination UserForm.

    I need when the user Select "Add" to add the following
    What other issues are you having?
    Last edited by jaslake; 08-13-2013 at 04:05 PM.

  23. #23
    Forum Contributor
    Join Date
    03-29-2012
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    818

    Re: CellValue = TextBox6 + TextBox4(*7) VBA

    Jaslake this works perfectly... Thank you so much.

    I have made another UserForm that has all the questions and cmdbuttons with some Height and Width change plus hide and unhide including .visible = False/True

    But will definitely add your code you have just given me this is awesome you guys are on point.

    You guys are helping me be better at these sort of code

  24. #24
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: CellValue = TextBox6 + TextBox4(*7) VBA

    You're welcome...glad I could help. Thanks for the Rep.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Search for fontcolour, copy row to another existing workbook, to sheet with cellvalue-name
    By Marloes in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-21-2012, 08:44 AM
  2. [SOLVED] Returning last cellvalue in row
    By Lv27 in forum Excel General
    Replies: 6
    Last Post: 08-21-2012, 07:28 AM
  3. Write data to different sheets depending on cellvalue
    By JaSc68 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-16-2012, 10:05 PM
  4. [SOLVED] highlight/remove highlight of rows conditional on cellvalue
    By timtim89 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-01-2012, 07:14 AM
  5. [SOLVED] TextBox6.Text = Application.??????????(TextBox6.Text)
    By Jim at Eagle in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-30-2005, 11:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1