+ Reply to Thread
Results 1 to 2 of 2

VBA For Xlookup funct that auto fills to dynamic last row

  1. #1
    Registered User
    Join Date
    11-10-2022
    Location
    Miami, Florida
    MS-Off Ver
    microsoft 365
    Posts
    1

    Question VBA For Xlookup funct that auto fills to dynamic last row

    I am fairly new to VBA and I am working on having an xlookup function to return a certain value. I got the function working for the first cell, however when i try to autofill down it just autofills the result from the first cell down to the very last row. Down below is the code I currently have. I would want for each cell to have the formula all the way to the very last row of data.

    Range("N1").Select
    Selection.Value = "School By Email"

    Dim usercw As Worksheet
    Dim usercwe As Range
    Dim usercws As Range

    Set usercw = Sheets(1)
    Set usercwe = usercw.Range("G:G")
    Set usercws = usercw.Range("J:J")

    Range("n2").Select
    ActiveCell = Application.WorksheetFunction.XLookup(Range("C2"), usercwe, usercws)


    The xlookup funct. is looking at another sheet in the very same Workbook and then returning a value from that very same sheet.

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,615

    Re: VBA For Xlookup funct that auto fills to dynamic last row

    use:
    Please Login or Register  to view this content.
    then the formula in a sheet will have reference to C2 address not the C2 value and filling down it will refer to C3; C4; and so on
    Best Regards,

    Kaper

+ 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] XLOOKUP Dynamic Return Value
    By MangoFresh in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-07-2022, 09:01 AM
  2. [SOLVED] Macro that auto fills cells
    By Mattyevs1000 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-05-2019, 07:39 PM
  3. [SOLVED] Clicking on cell that auto fills an X and removes all other auto fills in a range
    By ERaasio in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-26-2013, 12:31 PM
  4. Drop-Down Box which auto-fills another cell
    By kimi4989 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-17-2013, 11:53 PM
  5. auto fills
    By raymonddic in forum Excel General
    Replies: 6
    Last Post: 06-07-2007, 10:02 PM
  6. [SOLVED] Dynamic Range, Data Validation and Address, Match and Offset Funct
    By rudawg in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-28-2006, 11:25 PM
  7. Question about auto fills or linking sheets
    By CEN in forum Excel General
    Replies: 4
    Last Post: 07-14-2005, 04:05 PM

Tags for this Thread

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