+ Reply to Thread
Results 1 to 6 of 6

Cell.Replace "XY", Variant(I) & "XY" formulla builder not functioning

  1. #1
    Forum Contributor
    Join Date
    06-22-2011
    Location
    somerset
    MS-Off Ver
    365
    Posts
    328

    Cell.Replace "XY", Variant(I) & "XY" formulla builder not functioning

    I have a UDF that needs to be replaced with a built in equation (macro enabled workbooks cannot be saved on this server).

    I wrote a formulla to do this but the result has long equations that cannot be passesed as strings so I had to write an assembler into the mix.
    I could have sworn I had tested it and it was working but I am running it now and it isn't doing anything.

    This is the assembler script is:
    Please Login or Register  to view this content.
    M and T are arrays of strings that contain multiplied addresses (the end formulla basically lets me use non-continuouse ranges in sumproduct)

    the code executes fine no errors pop up but at the end of it the formulla in the cell is still "{=SUM(A2)/SUM(B3)}". I have stepped through it and when I get to this step all the strings are fine and the refferences are correct, VBA just isnt replacing "A2" with M(I) & "A2".

    any Ideas what is causing this?
    I will try again when I get back in work on monday and see if the function is working again (which I am sure it was, I have some files where this has been run and the formulla is fine on them).




    I am sure someone will ask for the full module (someone always does, thinking it is rellevent) so here it is:
    Please Login or Register  to view this content.
    Last edited by Leon V (AW); 03-03-2014 at 06:21 AM.
    Sub Reputation()
    Dim Problem as Variant
    Dim Reputation as Integer
    For Each Problem in Forum.Threads
        If Problem.Title = "*[Solved]*" and Solver.Name = "Leon V (AW)" Then Reputation = Reputation + 1
    Next Problem
    End Sub

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,943

    Re: Cell.Replace "XY", Variant(I) & "XY" formulla builder not functioning

    M and T are arrays of strings that contain multiplied addresses (the end formulla basically lets me non-continuouse ranges in sumproduct)
    Is there logic to your layout of non-contiguous ranges? If there is.....
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Forum Contributor
    Join Date
    06-22-2011
    Location
    somerset
    MS-Off Ver
    365
    Posts
    328

    Re: Cell.Replace "XY", Variant(I) & "XY" formulla builder not functioning

    there is but the data that is used to form that logic is destroyed during it's creation in an earlier macro used to merge some data sheets together.

  4. #4
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,943

    Re: Cell.Replace "XY", Variant(I) & "XY" formulla builder not functioning

    Quote Originally Posted by Leon V (AW) View Post
    there is but the data that is used to form that logic is destroyed during it's creation in an earlier macro used to merge some data sheets together.
    I thought the idea was to remove the macros... if you are using macros to merge sheets together, why not just continue to use VBA code? Or, if you are actually removing macros, just get the formulas to work by entering them instead of creating VBA code (with all the cell addresses as part of the code) to create formulas. Since it is likely that you have to do this to many many workbooks, create a template with the correct formulas and just have the macro import the required data into the template, then save a copy of the template over the existing file, and repeat as needed.

  5. #5
    Forum Contributor
    Join Date
    06-22-2011
    Location
    somerset
    MS-Off Ver
    365
    Posts
    328

    Re: Cell.Replace "XY", Variant(I) & "XY" formulla builder not functioning

    There are no macros on the sheet all macros are in an addin this script (named DeAddin) as the name implies makes the sheet readable for people without the addin (as the addin also contains some UDFs that makes these equations much easier to use.
    for e.g. and this is a very small one:
    with addin UDF
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    without addin default excel method
    Formula: copy to clipboard
    Please Login or Register  to view this content.



    and here is a long one (this sheet isn't ready to be converted yet so I don't have a post run version):
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Last edited by Leon V (AW); 03-03-2014 at 12:06 PM.

  6. #6
    Forum Contributor
    Join Date
    06-22-2011
    Location
    somerset
    MS-Off Ver
    365
    Posts
    328

    Re: Cell.Replace "XY", Variant(I) & "XY" formulla builder not functioning

    I have tested
    Please Login or Register  to view this content.
    and
    Please Login or Register  to view this content.
    and
    Please Login or Register  to view this content.
    and they work fine. so why can VBA not combine them????????

+ 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. replace all defined range names in the sheet that start with "Street" to "Road"
    By matrex in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 11-04-2016, 08:53 AM
  2. Replies: 4
    Last Post: 11-17-2013, 12:05 PM
  3. [SOLVED] How to USE """"" cells count """"" change font color
    By austin123456 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-09-2013, 06:14 AM
  4. [SOLVED] If there is any text in column "A$" on "sheet1" then move cell to column "A$" on "sheet2"
    By ckgeary in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-27-2013, 08:28 PM
  5. Replies: 5
    Last Post: 10-12-2010, 06:46 AM

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