+ Reply to Thread
Results 1 to 18 of 18

Need a macro to pick the details from Tab mentioned one after another

  1. #1
    Registered User
    Join Date
    06-25-2020
    Location
    India
    MS-Off Ver
    Office 365
    Posts
    11

    Post Need a macro to pick the details from Tab mentioned one after another

    Hi, I am trying to work on a macro that will pick the details from each tab as requested in Inputs Tab. Pick the details & consolidate it in 1 output file (only the required fields). But no luck. Appreciate if someone can help me code this. Thanks a lot in advance.

    Attaching the sample document for your reference.
    Attached Files Attached Files

  2. #2
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,056

    Re: Need a macro to pick the details from Tab mentioned one after another

    Try:
    Please Login or Register  to view this content.
    Last edited by Mumps1; 07-27-2020 at 12:55 PM.
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  3. #3
    Valued Forum Contributor
    Join Date
    02-14-2019
    Location
    Turkiye
    MS-Off Ver
    2010 - 64 Bit on Windows-11 (24 H2) 64 Bit
    Posts
    1,187

    Re: Need a macro to pick the details from Tab mentioned one after another

    An alternative, using ADO/SQL can be found in the attached file.

    Note:
    1) Due to "Securi" I couldn't post the code.
    2) Inputs are hard coded.
    Attached Files Attached Files
    Last edited by Haluk; 07-27-2020 at 01:56 PM.

  4. #4
    Registered User
    Join Date
    06-25-2020
    Location
    India
    MS-Off Ver
    Office 365
    Posts
    11

    Re: Need a macro to pick the details from Tab mentioned one after another

    Hi Mumps, Thank you so much for your time in helping me on this.

    I copy pasted the code in the excel workbook I shared as sample. am getting an error while I run this code...
    at "With Sheets(rng.Value)". Am I doing something different.

    A couple of addtions though. In output column, may be in the new column, Is there a chance to pick the tab name, from where the data is pulled from, as there are multiple Tabs.

    Also based on the Qtr Selection drop down in Inputs, We need to pull only those 3 months of data into Input Tab.
    Like if I select Q1,The Plan data should be from Jan to Mar & Actual Data is Jan to Mar.

    Just to summarize:
    1. I need only the specific columns as mentioned in the input. Eg, I Dont need Sales pull.
    2. Also need specific Quarter pull for both Plan & Actual.Attaching the latest template.
    3. Need a column in Out put to show the Tab name the record is pulled from.


    Appreciate for your quick help on this to me.
    Attached Files Attached Files
    Last edited by sai.krishnaa2006; 07-27-2020 at 06:57 PM.

  5. #5
    Registered User
    Join Date
    06-25-2020
    Location
    India
    MS-Off Ver
    Office 365
    Posts
    11

    Re: Need a macro to pick the details from Tab mentioned one after another

    Hi Haluk, Thanks for your time on this.

    It runs perfectly, A little modified request though. Sorry for the last minute modification.

    1. I need only the specific columns as mentioned in the input. Eg, I Dont need Sales pull.
    2. Also need specific Quarter pull for both Plan & Actual.Attaching the latest template.
    3. Need a column in Out put to show the Tab name the record is pulled from.

    Hope this can be doable.

    Also I am very much interested in learning ADO / SQL language. Please guide me on that. Thank you so much.
    Attached Files Attached Files

  6. #6
    Valued Forum Contributor
    Join Date
    02-14-2019
    Location
    Turkiye
    MS-Off Ver
    2010 - 64 Bit on Windows-11 (24 H2) 64 Bit
    Posts
    1,187

    Re: Need a macro to pick the details from Tab mentioned one after another

    You're welcome...

    As per the additional details given in your message #5; the columns "S.No, Parciculars, Size, Status and data of the 2nd quarter" are being imported into the sheet "Output" in the attached workbook, VBA-ADO-SQL.
    Attached Files Attached Files

  7. #7
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,056

    Re: Need a macro to pick the details from Tab mentioned one after another

    For clarification:

    Your comment in Inputs says: "Size is not required." However, in your last post you said: "I Don't need Sales pull." Please clarify.

  8. #8
    Registered User
    Join Date
    06-25-2020
    Location
    India
    MS-Off Ver
    Office 365
    Posts
    11

    Re: Need a macro to pick the details from Tab mentioned one after another

    Oh Yes, Thanks for correcting my statement.
    I dont need Size.

    Through VBA is that possible to achieve the below by any chance?

    1. I need only the specific columns as mentioned in the input. Eg, I Dont need Size pull.
    2. Also need specific Quarter pull for both Plan & Actual.Attaching the latest template.
    3. Need a column in Out put to show the Tab name the record is pulled from.

    Thank you so much in advance.

  9. #9
    Registered User
    Join Date
    06-25-2020
    Location
    India
    MS-Off Ver
    Office 365
    Posts
    11

    Re: Need a macro to pick the details from Tab mentioned one after another

    Hey Haluk, This helps me. However looking for a dynamic pull using Input as the source for
    1. Information only specific Worksheets (Only mentioned Tab to be retrieved, as I will have another 10 tab which I would not need to pull),
    2. Qtr. to Pull (If I select Q2, it has to be Apr to Jun, If Selection is Q3 the July to Sep like wise.)
    3. In a column by any chance can we bring up the Tab Name to aligh to each record. so that I will know which record is pulled from which worksheet.

    Thank you so much for your effort on this.

  10. #10
    Valued Forum Contributor
    Join Date
    02-14-2019
    Location
    Turkiye
    MS-Off Ver
    2010 - 64 Bit on Windows-11 (24 H2) 64 Bit
    Posts
    1,187

    Re: Need a macro to pick the details from Tab mentioned one after another

    If the sheet names are not listed in the columns of the tables, ADO/SQL can not retrieve the sheet names with this type of SQL statement.

    But, if we use a For-Next loop to make a query on each sheet, then sheet names can also be retrieved.
    Last edited by Haluk; 07-28-2020 at 10:36 AM.

  11. #11
    Registered User
    Join Date
    06-25-2020
    Location
    India
    MS-Off Ver
    Office 365
    Posts
    11

    Re: Need a macro to pick the details from Tab mentioned one after another

    Okay. Anything should work, as long as I could showcase the worksheet names. Please can you send me that version with the requested changes, so I can carry them forward to the live version with all your help. Thank you

  12. #12
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,056

    Re: Need a macro to pick the details from Tab mentioned one after another

    Try the attached file. I have made some minor changes in the source sheets. You no longer need the button. When you make a selection in cell G4, the data will be copied automatically.
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    06-25-2020
    Location
    India
    MS-Off Ver
    Office 365
    Posts
    11

    Re: Need a macro to pick the details from Tab mentioned one after another

    Mumps1... Amazing, you made my day. Thank youu thank you thank you so much!!!!

    I will now try to replicate this one in the live file.

    Pls make me your student!!!!!

  14. #14
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,056

    Re: Need a macro to pick the details from Tab mentioned one after another

    You are very welcome.

  15. #15
    Registered User
    Join Date
    06-25-2020
    Location
    India
    MS-Off Ver
    Office 365
    Posts
    11

    Re: Need a macro to pick the details from Tab mentioned one after another

    Hi Mumps1,

    I have tried to incorporate the code in the live file and was able to troubleshoot most of it with my little knowledge. 1 place where I am failing is when my Input says only 1 worksheet in C4, then a error thrown at "with Sheets (rng.value)", in the file you have shared with me. When I place 2 or more, I am able to pull it without any error.

    Now coming to live file, irrespective of any numbers of worksheets name I give, it always stops at that particicular line to troubleshoot "with Sheets (rng.value)".

    Rest of the pull works file, just that it throws me that error. please help me to fix that. I would infact be happy to get a alert that "Pull is successful" once it completes.

    P.s: If I exactly give range - For each rng in srcws.range("C4 to C6") it doesnot throw any error. it only throws when I have For Each rng In srcWS.Range("C4:C" & LastRow) as a code.
    Last edited by sai.krishnaa2006; 07-29-2020 at 12:55 PM.

  16. #16
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,056

    Re: Need a macro to pick the details from Tab mentioned one after another

    Try:
    Please Login or Register  to view this content.

  17. #17
    Registered User
    Join Date
    06-25-2020
    Location
    India
    MS-Off Ver
    Office 365
    Posts
    11

    Re: Need a macro to pick the details from Tab mentioned one after another

    Yes Mumps1. This one work fine now.

    Thank you so much for your swift responses.

  18. #18
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,056

    Re: Need a macro to pick the details from Tab mentioned one after another

    You are very welcome.

+ 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. Replies: 2
    Last Post: 02-22-2018, 03:55 AM
  2. macro need to copy & paste the date mentioned in a column for all the values
    By excelhelpseeker in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-02-2015, 06:44 AM
  3. Help regarding a formula to pick details
    By MYEM1983 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-22-2014, 07:02 AM
  4. Replies: 0
    Last Post: 05-25-2014, 02:33 PM
  5. Create userform that allows user to pick a color, then have macro reference the color pick
    By submariner18 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-21-2013, 05:04 PM
  6. macro to copy rows to another sheet based on condition mentioned in another workbook
    By sona_tejas in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-07-2013, 06:23 AM
  7. Replies: 4
    Last Post: 10-11-2012, 12:44 AM

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