+ Reply to Thread
Results 1 to 9 of 9

VBA Pulling Data From Other Sheets Remove Duplicates

Hybrid View

btone VBA Pulling Data From Other... 03-22-2016, 11:50 AM
dflak Re: VBA Pulling Data From... 03-22-2016, 05:27 PM
btone Re: VBA Pulling Data From... 03-23-2016, 09:24 AM
dflak Re: VBA Pulling Data From... 03-23-2016, 11:02 AM
btone Re: VBA Pulling Data From... 03-23-2016, 12:04 PM
dflak Re: VBA Pulling Data From... 03-23-2016, 12:18 PM
btone Re: VBA Pulling Data From... 03-23-2016, 12:35 PM
dflak Re: VBA Pulling Data From... 03-23-2016, 12:55 PM
btone Re: VBA Pulling Data From... 03-23-2016, 02:09 PM
  1. #1
    Registered User
    Join Date
    10-22-2014
    Location
    San Diego, CA
    MS-Off Ver
    Excel 2011
    Posts
    44

    VBA Pulling Data From Other Sheets Remove Duplicates

    Hey All,

    I have three worksheets in this sample workbook, but my real workbooks could have many more worksheets. My goal is to create a macro that will pull all of the row data from the "160" and "300" worksheets onto the "Main" worksheet, but I don't want to have duplicates on the "Main". The "160" and "300" worksheets will have some identical rows.

    I would like to have the data in the "main" sheet sorted by Column A and then by Column C and D. Also, I would like to leave a couple blank rows after there is a switch to the new symbols in column A.

    Column F will have clickable hyperlinks that can vary in length depending on the length of the article title. If the title goes past the page break, I would like to create a new row to continue F column data directly below the corresponding row.

    It is important to add that there could be hundreds of rows depending on the day, so the macro would need to look down the columns and not be limited to the sample worksheet data provided.

    Any help would be much appreciated. I have attached the spreadsheet.
    Attached Files Attached Files

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,957

    Re: VBA Pulling Data From Other Sheets Remove Duplicates

    Is it the combination of all 6 columns that makes the row unique?
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Registered User
    Join Date
    10-22-2014
    Location
    San Diego, CA
    MS-Off Ver
    Excel 2011
    Posts
    44

    Re: VBA Pulling Data From Other Sheets Remove Duplicates

    Hey dflak,

    Yes, each of the 6 cells in the row are dependent on each other.

  4. #4
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,957

    Re: VBA Pulling Data From Other Sheets Remove Duplicates

    I got to the part where you want hyperlinks. Hyperlinks to what? What is in there seems to be hyperlinks to something other than the world wide web.

    For example Excel.com is fdsup://directions/News%20HTML%20Viewer?action=OPEN&on_error=off&window=popup_no_button&start_maximized=false&creator=factset&display_string=Click%20to%20view%20document&width=640&height=480&address=ZQFNAqDjk%2B6rdm%2FDvdx%2Bz5GQJaFphVC4Ns4tZCwMl7ueerIX8jiHEZRZ32DFMnHDEm48oYvVsyboSTdNXyWExV0ZNxREQ9DXPQRsw7QTotO6EiCLafnhBg5fXp3Duikt%2Fo0B1rBG5VNSb1KkoFtkfsSWoJm6ANXEUWfo7BZfUbwS8tBVE%2BQzCpMi9fr1KCpqfMb2VasYyhbkKldlPU5%2BB5O5B01z3XzDienq4e8U44%2BoAqe4DW3BdtnWXh2K5xUNbfmbXvShxCNRcZfaicrHOjiXPhAcda4ot4DpHNd6KMM4x5ZlSWkXpch1xwhuGntMBRb3%2B3%2Fvaaj6vN4Kp7pmuDJa

    If I nuke the hyperlink and prefix the text with "http://www." I get an error message on the second line. Application-defined or object-defined error. this might have to do with the punctuation in the text. The first line does produce a link and there is no such web site.

    So I need more definition as to what you mean by "clickable hyperlinks."

  5. #5
    Registered User
    Join Date
    10-22-2014
    Location
    San Diego, CA
    MS-Off Ver
    Excel 2011
    Posts
    44

    Re: VBA Pulling Data From Other Sheets Remove Duplicates

    The reason for the hyperlink error is because it coming from a FactSet database. You must have the Factset add-in to be able to view the link, which is a paid subscription (I don't know how familiar you are with the database).

    I have a code in cell B2 that basically transposes identifiers(column B) down the columns looking back 24hours...Date(Column C), Time the news article is released (Column D), News Source prefix (Column E) and Column F is the title of the link as a hyperlink, which if clicked by the user(with Factset access) will open up a html file of the article. Column A is only a VLOOKUP looking at Column B.

    I am sorry for the poor details on my part. I wish I was able to figure the macro out myself, but I am new to VBA and am not able to 'record' something like this because of the complexity. Now I am wondering if this is even possible with a hyperlink involved?

  6. #6
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,957

    Re: VBA Pulling Data From Other Sheets Remove Duplicates

    Are you saying that the links work for you and that I should just keep them in place?

    Here is what I have so far. I still need to add the piece to insert new rows on a change in row A, and the part about breaking the title to the next row if it exceeds the page break.

    That latter requirement might be difficult to do. Page breaks depend on things like margin settings and compression (scale). If the text exceeds the page break, depends on the font used and if it is a proportional font, the actual characters used. What could be done more reasonably is to extend column F to the edge of the screen and let the text wrap. Even this will vary from monitor to monitor.

    Take a look at the code. It is basically doing a lot of small tasks one after the other.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    10-22-2014
    Location
    San Diego, CA
    MS-Off Ver
    Excel 2011
    Posts
    44

    Re: VBA Pulling Data From Other Sheets Remove Duplicates

    Yes, the links work for me and they should be kept in place.

    The code looks great. Thank you for putting in the amount of time you have.

    The insertion of new rows is not as important as the the 'link title' extending past the page break. Ultimately, I am going to export this to pdf and I would like it to look somewhat clean without the link title being cutoff after only a couple words. If it is better to extend column F that will work. I would only like it to look as clean as possible.

    Thank you again.

  8. #8
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,957

    Re: VBA Pulling Data From Other Sheets Remove Duplicates

    Here's my best and final offer . I commented out the code that removes and attempts to add hyperlinks. I copied them over "as is."

    It adds the space and wraps the hyperlinks. I "eyeballed" expanding column F to compromise between getting as much as I can on a line without wrapping and not getting so much on a line that it shrinks the text when printed. I set up printing for landscape, narrow margins and all columns on one page. The sample prints reasonably well in PDF.
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    10-22-2014
    Location
    San Diego, CA
    MS-Off Ver
    Excel 2011
    Posts
    44

    Re: VBA Pulling Data From Other Sheets Remove Duplicates

    Thank you very much! I am going to try and implement your code in the larger workbook. Thanking for the comments within the code as well it will be very helpful.

+ 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. Pulling Non-Duplicates Between Sheets
    By BarryGoddard in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 06-25-2015, 08:23 AM
  2. Need a macro to Compare multiple sheets and Remove Duplicates
    By ajaypal.sp in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-03-2015, 12:18 PM
  3. [SOLVED] Remove Duplicates from both sheets reading Col B+C
    By analystbank in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-29-2015, 05:32 AM
  4. [SOLVED] function to remove duplicates from different sheets
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-03-2014, 08:03 AM
  5. Using Large Function & Pulling Adjacent Data (Problem With Duplicates)
    By demonfly100 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-28-2013, 05:24 AM
  6. Replies: 1
    Last Post: 10-23-2012, 09:12 AM
  7. Replies: 4
    Last Post: 08-17-2006, 01:30 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