Results 1 to 15 of 15

Revise marco so searched output is in new workbook plus search 2 sheets, add headers

Threaded View

  1. #1
    Registered User
    Join Date
    04-23-2020
    Location
    NYC
    MS-Off Ver
    MS Office 365 (2019)
    Posts
    8

    Question Revise marco so searched output is in new workbook plus search 2 sheets, add headers

    Hi All,


    I have used the following macro to create a report based on criteria. Currently, it outputs the results to a sheet labeled "Report". I need to revise the code to add some additional aspects.


    1. I would like the output to be to a new workbook.


    2. The macro as written only searches the sheet "HOTLINE" and returns the rows that have the search criteria "Unqualified Lead" in Column A. I would like for it to search 2 sheets: HOTLINE and WEBINAR for the same search criteria.

    3. I would like for the output to be in a new workbook with two sheets: HOTLINE AND WEBINAR and use the headers from the original tabs for the outputted rows



    Could I get some help on how to revise the code to achieve this? The original code is below:

    EDIT: I've attached a sample file!



    Sub UnqualifiedLeads()
    'Updated 4-21-2020
        Dim xRg As Range
        Dim xCell As Range
        Dim I As Long
        Dim J As Long
        Dim K As Long
        I = Worksheets("HOTLINE").UsedRange.Rows.Count
        J = Worksheets("Report").UsedRange.Rows.Count
        If J = 1 Then
        If Application.WorksheetFunction.CountA(Worksheets("Report").UsedRange) = 0 Then J = 0
        End If
        Set xRg = Worksheets("HOTLINE").Range("A1:A" & I)
        On Error Resume Next
        Application.ScreenUpdating = False
        For K = 1 To xRg.Count
            If CStr(xRg(K).Value) = "Unqualified Lead" Then
                xRg(K).EntireRow.Copy Destination:=Worksheets("Report").Range("A" & J + 1)
                J = J + 1
            End If
        Next
        Application.ScreenUpdating = True
        MsgBox "Unqualified Lead Report Complete!", vbExclamation
        Sheets("Report").Select
    End Sub
    Attached Files Attached Files
    Last edited by tseb3; 04-27-2020 at 08:43 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 7
    Last Post: 02-13-2017, 04:51 PM
  2. [SOLVED] Any Faster Way to Copy/Paste this range? (I have searched and searched and searched)
    By liquidmettle in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 12-12-2015, 02:33 PM
  3. Merging All the sheets from different workbook , provided the headers are same.
    By Praveenk in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-24-2015, 07:50 AM
  4. [SOLVED] Macro to search all sheets and return corresponding rows of searched value
    By amar05 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-19-2013, 01:56 AM
  5. Search multiple workbook headers and copy column entries to another workbook
    By R3n3gad3-XtC in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-13-2012, 12:47 AM
  6. Replies: 0
    Last Post: 11-29-2012, 06:37 AM
  7. Auto filter multiple columns matching with searched headers
    By gotovamsee in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-08-2011, 03:20 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