+ Reply to Thread
Results 1 to 7 of 7

Using function result as cell address

  1. #1
    Registered User
    Join Date
    11-18-2013
    Location
    Zurich, Switzerland
    MS-Off Ver
    Excel 2010
    Posts
    54

    Using function result as cell address

    Hi,

    I would to use the result of a function as the address of a cell. For example here:
    Formula1:="=Sheet2!$A$2:$A$300"

    I want to replace 300 with the result of a function inside a VBA or the data validation range. Either something like

    $A$2:$A$(COUNTA(A:A)), where counta returns a number (50, 55 or whatever) OR
    $A$2: (ADDRESS(COUNTA(A:A),1)), where Address returns something like $A$50.

    Any ideas?

  2. #2
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Using function result as cell address

    Hi and welcome to the forum!

    As you intimated, there are several methods which will achieve this, though it depends exactly how the upper range reference is to be determined. Is it, for example, the last used cell in the range? Or perhaps you simply wish to have a cell containing a text string representing a cell reference and indirectly refer to that in the formula?

    The actual approach is quite different in each case. If you can be a little more specific about your requirements, I'm sure we'll be able to help.

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  3. #3
    Registered User
    Join Date
    11-18-2013
    Location
    Zurich, Switzerland
    MS-Off Ver
    Excel 2010
    Posts
    54

    Re: Using function result as cell address

    Hi again and thanks!

    I want to make a unique data validation list and I do that by using a macro. In the Macro:

    -First I copy the column (rows + 200/300 more for future inputs) to another (hidden/useless) sheet
    -I remove the duplicates
    -Then I use a data validation list by using the unique list but I want a dynamic range so as NOT to
    have many blanks from the extra blank rows.

    So in the macro I want to use has a range like:
    Formula1:="=Sheet2!$A$2:$A$(COUNTA(A:A))"

    So instead of having a fixed end, define the end of the range as the last non blank cell of column A.
    COUNT(A:A) gives that, e.g. 50 or 60, so I want to use the end (A60 in this case) through this function.

  4. #4
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Using function result as cell address

    Please Login or Register  to view this content.
    I believe

  5. #5
    Registered User
    Join Date
    11-18-2013
    Location
    Zurich, Switzerland
    MS-Off Ver
    Excel 2010
    Posts
    54

    Re: Using function result as cell address

    I don't think it works...

  6. #6
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Using function result as cell address

    Can you be more specific - it seems to be ok to me, how doesn't it work?

    Note, I think the most common method for getting the last non blank cell is:
    Range("A" & rows.count).end(xlup)

    So for your formula this would be:
    Formula1:="=Sheet2!$A$2:$A$" & Range("A" & rows.count).end(xlup).row

  7. #7
    Registered User
    Join Date
    11-18-2013
    Location
    Zurich, Switzerland
    MS-Off Ver
    Excel 2010
    Posts
    54

    Re: Using function result as cell address

    I think it works now, thanks! You just need your sheet also in the range.

    Formula1:="=Sheet2!$A$2:$A$" & Range("Sheet2!A" & rows.count).end(xlup).row

+ 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. Move to the result of the address function
    By Wigglebritches in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-20-2013, 12:37 AM
  2. [SOLVED] Using the result of a CELL "address" function in another function
    By jphalverson in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-21-2013, 11:36 AM
  3. How do you use ADDRESS function result in a macro as a paste destination
    By phanjoe in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-04-2012, 01:10 PM
  4. Convert ADDRESS() function result to literal text
    By ajetrumpet in forum Excel General
    Replies: 6
    Last Post: 03-18-2011, 04:20 PM
  5. Using address function result in an array
    By RLR in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-08-2006, 10:25 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