+ Reply to Thread
Results 1 to 4 of 4

Fetch data from sheet having same name as of data heading

  1. #1
    Forum Contributor
    Join Date
    12-25-2011
    Location
    Lahore, Punjab, Pakistan
    MS-Off Ver
    Excel 2010
    Posts
    287

    Fetch data from sheet having same name as of data heading

    Hi,

    Here I am with a simple problem.

    Is it possible with vba to pull data from other sheets based on criteria of matching the heading name and sheet name.
    I have attached the file. Sheet1 contains the cells (C5 to N13) that need to be filled using vba code.

    Thank you all for your assistance.
    Attached Files Attached Files
    Last edited by caabdul; 01-22-2014 at 11:15 PM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Fetch data from sheet having same name as of data heading

    No VBA is needed. Put this formula in C5, then copy down and across:

    =VLOOKUP($B5, INDIRECT("'" & C$4 & "'!B:C"), 2, 0)
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Contributor
    Join Date
    12-25-2011
    Location
    Lahore, Punjab, Pakistan
    MS-Off Ver
    Excel 2010
    Posts
    287

    Re: Fetch data from sheet having same name as of data heading

    Hi Thank you for your assistance. About 90% of the problem is resolved that I have the right formula to be used.

    I was wondering if there is any way that I can use VBA to enter formula in each cell of the given space in sheet1? For example we may use End(xlDown) etc.

    Thanks

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Fetch data from sheet having same name as of data heading

    Yes, you can turn on the macro recorder and let it record you entering that formula in the first cell, that gives you the VBA version of the formula and the starting cell.

    Then you can use end(xlDown) as a method of targeting the entire range, or even try the .Resize(?, ?) method. For resize you could countA the number of values in column B, then subtract 1 to get the number of rows, do the same for row 4 to get the number of columns, then put those values into the RESIZE and your formula would be applied to that entire resized range expanding out from C5.

    Give it a good try.

+ 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. Fetch the data from an UI and paste it in a seperate sheet
    By Naman555 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-03-2013, 06:47 AM
  2. [SOLVED] VBA to fetch data from next sheet using command button
    By Daniel_12 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 04-22-2013, 07:24 AM
  3. [SOLVED] How to fetch data from one sheet in excel and insert into another sheet using VB
    By gokul1242 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-27-2012, 11:38 AM
  4. Fetch data from another sheet based on a filter value
    By jrule in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-30-2011, 12:38 PM
  5. need to fetch specified data from one sheet to another as a report
    By shamianram in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-02-2011, 11:08 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