Results 1 to 2 of 2

VBA - Pretty basic IF statement help needed

Threaded View

  1. #1
    Registered User
    Join Date
    05-23-2013
    Location
    Iowa
    MS-Off Ver
    Excel 2007
    Posts
    84

    Unhappy VBA - Pretty basic IF statement help needed

    Hi all,

    I'm looking for some help with a code.

    Specifically, this is what I need:

    1) Search for "Tenure" - IF found do nothing, IF not found insert a column in B for "Tenure", and the appropriate code from below to determine tenure in years.
    2) Search for "Age" - IF Found do nothing, IF not found insert a column in D for "Age", and the appropriate code from below to determine age in years

    Range("B2").Formula = "=ROUND((TODAY()-A2)/365.25,0)"
    Range("D2").Formula = "=ROUND((TODAY()-C2)/365.25,0)"
    
    Dim LastRow As Long
    LastRow = Cells.Find(What:="*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    Range("B2:B" & LastRow).FillDown
    
    Dim LastRoww As Long
    LastRoww = Cells.Find(What:="*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    Range("D2:D" & LastRow).FillDown
    Basically the same thing, just different wording. In about 10% of the files we receive, people will sometimes only list Tenure and not DOH (date of hire) or Age and not DOB(date of birth) - I need it to check if they already have this information provided otherwise, it needs to run the code to insert this data.

    Any help is appreciated.

    NOTE: I need them to be seperate for the fact that sometimes we'll receive one and not the other. Thanks.
    Last edited by crayhons; 06-13-2013 at 03:13 PM.

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