+ Reply to Thread
Results 1 to 5 of 5

Use Worksheet Formulas in VBA

  1. #1
    Registered User
    Join Date
    01-25-2013
    Location
    Taunton, England
    MS-Off Ver
    Excel 2003 Office, Excel 2010 Home
    Posts
    13

    Use Worksheet Formulas in VBA

    Hi All,

    I have a Worksheet that I need VBA to generate the formulas for as due to other requirements (not shown on attachment) VBA is the only option.

    My Requirement:

    In a Range ((D2:D5) the user selects text from a Validated List as "No Break"
    On Selecting that text VBA looks at the previous cell ((C2:C5) which is date formatted as dd mmm yy) and adds 182 to it.
    VBA then puts the revised date into the correct cell in the Range (E2:E5).
    i.e. 27 Sep 12 + 182 = 28 Mar 13
    Then:
    The cell in Range (E2:E5) has 91 added to it and this date is put in the correct cell in Range(F2:F5) i.e. 27 Jun 13

    I have read up on using VBA for formulas but cannot get my head around this.....apologies.

    I have attached a Workbook to further illustrate my question to you.

    Can anyone help?

    In Anticipation

    Craig

    Work: XP and 2002
    Home: W7 and 2010

    The more I learn, the more I want to know
    Attached Files Attached Files

  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: Use Worksheet Formulas in VBA

    Craig

    Perhaps I'm missing something but couldn't all this be done with formulas?

    What part of it do you think needs VBA?
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    01-25-2013
    Location
    Taunton, England
    MS-Off Ver
    Excel 2003 Office, Excel 2010 Home
    Posts
    13

    Re: Use Worksheet Formulas in VBA

    Hi Norrie,

    Please excuse my lack of knowledge:

    I am unsure as to how write the formulas to get the result I want.

    The problem (only as I see it) is if the user selects another option from the list they have to manually input the Date into column C as they need to check another Date Calculator: I can of course leave Column F with formula based on what they input into previous column / cell, so that is my omission.

    The manual input is due to complications with having to do additional checks based on what is selected in the dropdown.

    Therefore I believed that using VBA for the "No Break" option was the best way as it removes the need to validate the other other options entry.

    I trust I have made sense but if sheet formulas can be used that would be the preferred option.

    Craig

  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: Use Worksheet Formulas in VBA

    Craig

    Where does the date in column C come from?

  5. #5
    Registered User
    Join Date
    01-25-2013
    Location
    Taunton, England
    MS-Off Ver
    Excel 2003 Office, Excel 2010 Home
    Posts
    13

    Re: Use Worksheet Formulas in VBA

    Norrie,

    The date in column C is manually entered as it is cross referenced from a different system.

    Craig

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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