+ Reply to Thread
Results 1 to 3 of 3

Adjusting code to check column, and insert formula

  1. #1
    Registered User
    Join Date
    08-05-2009
    Location
    Winnipeg, Canada
    MS-Off Ver
    Excel 2003
    Posts
    61

    Adjusting code to check column, and insert formula

    Here is a snippet of code I have. What it is doing is looking at the row which was just pasted by the earlier code and clearing out everything that isn't a formula. The problem is in columns "N, P, R, T" the formula was "=if(isblank($L2),"",$L2)", which is just there to make data entry easier. If someone puts a date in L2, the sheet fills that into columns NPRT because the date will usually be the same for all those, and if it does change, it's only by a day, so it's easier to edit than punch in yyyy-mm-dd again.

    Problem being sometimes people do change it, which means the formula I have in row two is probably gone by row ten. So I think I need to add another check to the code below, to see if we're currently in a cell that is in one of my watched columns, and if so, paste in the formula that would be something like:

    =if(isblank($L_ourCurrentRow),"",$L_ourCurrentRow)

    I am requesting assistance modifying the code below to achieve this.

    Please Login or Register  to view this content.
    This thread here is the closest thing I can find so far to what I'm trying to do, but my attempts to change the row check "r" to a column check aren't working.

  2. #2
    Forum Expert contaminated's Avatar
    Join Date
    05-07-2009
    Location
    Baku, Azerbaijan
    MS-Off Ver
    Excel 2013
    Posts
    1,430

    Re: Adjusting code to check column, and insert formula

    Try this out

    Please Login or Register  to view this content.
    Люди, питающие благие намерения, как раз и становятся чудовищами.

    Regards, ?Born in USSR?
    Vusal M Dadashev

    Baku, Azerbaijan

  3. #3
    Registered User
    Join Date
    08-05-2009
    Location
    Winnipeg, Canada
    MS-Off Ver
    Excel 2003
    Posts
    61

    Re: Adjusting code to check column, and insert formula

    Greetings contaminated,

    That code wouldn't do what I need, so I must have explained it badly. This is the formula in columns N,P,R, and T on row 2: "=if(isblank($L2),"",$L2". The cell isn't protected though, so a user can enter another value. When my code runs to copy the last row, paste it to the next available row, in this case it copies row two and pastes it into row three, it won't necessarily copy the formula itself, if the user has changed it. But I always want it to copy the formula, regardless of whether a user over-writes it.

    Here is the full code that is running, in case it helps:

    Please Login or Register  to view this content.

+ 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