+ Reply to Thread
Results 1 to 16 of 16

help with VBA codes to extract selected data from worksheet on specific conditions

  1. #1
    Registered User
    Join Date
    09-09-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    40

    help with VBA codes to extract selected data from worksheet on specific conditions

    Hello to all

    I am new to this forum so first of all "A very warm hello" and I really really apologise if i am duplicating this OR posting this into a wrong thread..

    Now, i have attached a datasheet which has got lots of column. (see Sheet1)

    Want i want to achieve is, I have got a button on sheet2 called "Sue Hendry". I want my users to click on the button and wherever (on sheet1), Sue Hendry on column Y has got "Y", i want it to retrieve all the data for that. which is from column A to column S

    Is this possible?

    Eventually , i want to have a button for each heading from column T to column AC and it needs to do the exact same thing.

    PLease, any help be appreciated
    Attached Files Attached Files
    Last edited by HarryC; 09-09-2013 at 12:39 PM.

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

    Re: VBA Codes/ Macro help me please

    something along the lines of:
    Please Login or Register  to view this content.

  3. #3
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: VBA Codes/ Macro help me please

    Hi, HarryC,

    welcome to ExcelForum.

    Just take a second to reflect on your thread title and image you yourself would do a search on that title: what would you expect as a result? Maybe take your time and change it according to the forum rules to something a bit more reflecting your problem, and I´m sure we will be able to help you with your problem.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  4. #4
    Registered User
    Join Date
    09-09-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    40

    Re: VBA Codes/ Macro help me please

    Thanks so much Holger and appreciate your prompt response.
    and i apologise for the title and being naive about my forum title

    Coming back to the solution, the above didnt work
    I replaced the
    end sub
    next
    end sub

    WITH
    end IF
    next
    end sub

    It worked although, in the Sheet1, it has 3 places where column Y (sue Hendry) got "Y". but it only returns 1 row.

    And is there any way, the data is retrieved in a new sheet rather than top of the same sheet and it also displays the result with the column headers? please..thanks again guys..Really appreciate it

    To enable you guys to help me further, i have attached a new sheet with the above macro
    Attached Files Attached Files

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

    Re: VBA Codes/ Macro help me please

    Apologies, I should have tested that better, try this:
    Please Login or Register  to view this content.
    Change Sheet3 to the name of the sheet you want to put the data in, alternatively to add a sheet and put it in there:
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    09-09-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    40

    Re: VBA Codes/ Macro help me please

    This is brilliant

    Is there any way i could have the data displayed with the column headers please....
    This should be it for me to resolve my query :D

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

    Re: VBA Codes/ Macro help me please

    Change
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    and copy the information across using either:
    Please Login or Register  to view this content.
    or
    Please Login or Register  to view this content.
    Depending on whether you are using an existing sheet or adding a new one.

  8. #8
    Registered User
    Join Date
    09-09-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    40

    Re: VBA Codes/ Macro help me please

    @yudlugar

    Hello there

    Thanks a lot for helping me out

    One last query please. Probably being thick here. How can i allow the second macro to retrieve the data for Dawn Gray for example. I have given the thought of retrieving the data in the same sheet. If you see on Sheet 2, I have got the data retrieved for Sue Hendry. What i would like to do now is click on "Dawn Gray" and it clears the data for Sue and retrieves the data for Dawn?

    Is this possible. For example. i am attaching the latest sheet.

    Thanks
    Attached Files Attached Files
    Last edited by jeffreybrown; 09-10-2013 at 07:29 AM. Reason: As per Forum Rule #12, please don't quote whole post unless necessary -- it's just clutter.

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

    Re: help with VBA codes to extract selected data from worksheet on specific conditions

    Sorry, not sure if I'm allowed to help or not.

  10. #10
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: help with VBA codes to extract selected data from worksheet on specific conditions

    Hi, yudlugar,

    green light is on for you to help

    jeffreybrown has requested a change of title, HarryC has responded to that and altered the thread title, so jeffrey deleted his post as he had stated in it because their no longer was a need for it.

    Ciao,
    Holger

  11. #11
    Registered User
    Join Date
    09-09-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    40

    Re: help with VBA codes to extract selected data from worksheet on specific conditions

    please help me. I think administrator is happy now as i have changed my title

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

    Re: help with VBA codes to extract selected data from worksheet on specific conditions

    Ok, wasn't sure because some posts still have the old title.

    HarryC,

    This:
    Please Login or Register  to view this content.
    Is the line that selects Sue Hendry (column Y), so for Dawn Grey you would need to change it to:
    Please Login or Register  to view this content.
    to clear the data:
    Please Login or Register  to view this content.

  13. #13
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: help with VBA codes to extract selected data from worksheet on specific conditions

    Hi, yudlugar,

    because some posts still have the old title.
    From what I remember the posts are written into the database with the thread title that was relevant the moment they were posted keeping the identying number of the starting post. The database will update the thread title accordingly to keep the record set together but the change of thread title may only be achieved by Admins/Mods changing them manually. Any new post will feature the altered or actual thread title.

    This procedure should be the same on all vBulletin boards.

    Ciao,
    Holger

  14. #14
    Registered User
    Join Date
    09-09-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    40

    Re: help with VBA codes to extract selected data from worksheet on specific conditions

    thanks again Yudlugar and exactly where this
    Sheets("Sheet2").cells.clearcontents
    Needs to be placed?

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

    Re: help with VBA codes to extract selected data from worksheet on specific conditions

    At the start,

    e.g.
    Please Login or Register  to view this content.

  16. #16
    Registered User
    Join Date
    09-09-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    40

    Re: help with VBA codes to extract selected data from worksheet on specific conditions

    Thanks Yudlugar. I appreciate your help. I will give this a go and see if it works. I am sure it will. Will come back later

+ 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. macro for weeknum
    By aesanchez in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-15-2013, 05:42 AM
  2. [SOLVED] Combine codes into one macro
    By Russ Fuquay in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-24-2013, 10:48 AM
  3. Combining vba codes makes the previous codes broken !
    By MDPLUS in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-26-2013, 10:00 AM
  4. Replies: 6
    Last Post: 11-28-2006, 01:08 PM
  5. Macro (Codes)
    By Bonbon in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-24-2006, 12:52 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