+ Reply to Thread
Results 1 to 3 of 3

duplicate user-defined function for cell

  1. #1
    Registered User
    Join Date
    12-10-2008
    Location
    Aberdeen
    MS-Off Ver
    MS365 VER 2308
    Posts
    79

    duplicate user-defined function for cell

    I can't seem to get this function to work... any ideas?

    Function mirror(rng1 As Range)
    Application.Volatile
    Application.Caller.Cells(1, 1).Interior.ColorIndex = rng1.Cells(1, 1).Interior.ColorIndex
    mirror= rng1.Cells(1, 1)
    End Function

    I just want one cell to mirror / track / duplicate another cell, including the formatting and contents, whatever that might be.

    For testing purposes, I'm happy for it to track the background color plus the contents, but in the end, I want it to track the full formatting / alignment / border as well as the contents.

    Essentialy, I'm going to have a row of 50 cells with this function mirroring a row further down the worksheet.

    I guess the only other way to do it would be a copy&paste within the worksheet_change method, but I can't understand why the above doesn't seemt to work.

    thanks
    Guy

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,869

    Re: duplicate user-defined function for cell

    A UDF called from the spreadsheet cannot alter the spreadsheet environment -- which includes changing the color and other formatting of the calling cell. A UDF could be used to mirror cell contents, but not formatting.

    I think you will have to go with some kind of change and/or calculate event procedure to mirror the formatting.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  3. #3
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: duplicate user-defined function for cell

    If you wish to mirror one complete range of cells, and not separate areas, you may try the camera tool.
    • Please remember to mark threads Solved with Thread Tools link at top of page.
    • Please use code tags when posting code: [code]Place your code here[/code]
    • Please read Forum Rules

+ 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. [SOLVED] User defined function returns an error on a standard function used in it.
    By pb48 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-23-2013, 01:35 PM
  2. [SOLVED] Excel - User Defined Function Error: This function takes no argume
    By BruceInCalgary in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-18-2006, 04:05 PM
  3. Replies: 0
    Last Post: 06-20-2006, 10:55 AM
  4. Color a result cell in a user defined function
    By aaa in forum Excel General
    Replies: 1
    Last Post: 05-08-2006, 11:25 AM
  5. [SOLVED] Determine the current cell while inside a User Defined Function
    By pmax in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-01-2006, 07:50 PM

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