RegEx - test formula in range

  • I am having a diffucult time performing a regular expression on the contents of a single range.


    I know the formula will be a simple sum function similiar to SUM(B191)/19.
    What I need to do is dynamically change the divisor (19) when the user enters values in certain cells. All is going ok except for actually performing the regex.


    What I thought of doing was to match everything up to and including the /, Assign it to a viariable, reuse that variable with my new divisor and throw the new formula in the cell.


    the regex section follows:


    FirstFormula was captured earlier, it is the contents for the first cell to change.


    I have simplified the RegEx.pattern to a straight string.
    I'm not a regex expert in Vb and can't seem to get the objects to work the way I want ... MUCH appreciated for any help ...

    <b><font color="#23069E">_NFio_</font></b>

  • Re: RegEx - test formula in range


    Well, I don't know exactly what range of cells I will need to change ...
    It's a single page for subtotaling monthly values, with a yearly total at the end cumulative for all months. There are 9 cells per row per day which will be updated. A monthly total and average at the end of each month section. The format repeats for each month. What I did is add an event to the last column of the last cell in the weekly row. When that cell changes, I need to find that month's tally section (each month has a cell with value median) - I use Cells.Find to find the "Median", the run selection.offset from there to find the ranges I need to change the formulas for. The divisee will be the same, but I need to change the divisor to the total exhausted day count for that month (of updated weeks). Weekdays are numbered, I obtain that value by using selection.offset from the same column I cell which triggered the event.


    ex.If today was weekday 10 for the month of 21 weekdays, after the user updates the last cell for that day I run this to change the divisor of all tallies for that month to 10 ...


    regex seemed natural for me to obtain the unique first half of the formula and remember it so that I can apply the changes then reassign that cell.


    If it can be done easier that would be great. At the same time I wouldn't mind getting a grip on regex in excel, as they're so usefull ...


    Thanx

    <b><font color="#23069E">_NFio_</font></b>

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!