+ Reply to Thread
Results 1 to 2 of 2

Thread: Cut Filtered Data into Separate Workbook.

  1. #1
    Registered User
    Join Date
    05-06-2011
    Location
    Alberta Canada
    MS-Off Ver
    Excel 2003
    Posts
    4

    Cut Filtered Data into Separate Workbook.

    Hi,
    I have some code that selects a certain range of data, copies it, and then pastes into a separate workbook.
    I need the code to first apply a filter, in column O = "Complete", and then cut that data, and paste in the separate workbook. If cut does not work, it can copy and then delete.

    Code is below:

    Public Sub SubmitComplete()

    Dim AuditSubmit As String


    'If Worksheets("UW_Rnls").Range("A9") = "" Then
    'MsgBox "There is No Date to Submit."
    'validateData = False
    'Exit Function
    'End If

    Savequestion = MsgBox("Do you have access to 'I drive'?", vbYesNo + vbQuestion)

    If Savequestion = vbNo Then
    MsgBox "You can not submit data to database if you do not have access to 'I drive'. You can save this program and send by email to someone in the office who have access to 'I drive' to submit for you."
    End If
    If Savequestion = vbYes Then


    Application.EnableEvents = False
    Application.ScreenUpdating = False


    On Error Resume Next 'Remove to debug
    Workbooks.Open "Desktop\Projects\Renewals\Test_Renewals_2.1\Proc_Renewals.xls" ', Password:="west"

    'Dim shtAnySheet As Worksheet
    'Dim sPassword As String
    'sPassword = "west"
    'Set shtAnySheet = Worksheets("COMM RNLS")
    'shtAnySheet.Unprotect sPassword

    ThisWorkbook.Sheets("UW_Rnls").Range("A9:W10").Copy 'need to copy all complete status
    Worksheets("Proc_Rnls").Cells(Rows.Count, "A").End(xlUp)(2, 1).PasteSpecial Paste:=xlPasteValues

    'shtAnySheet.Protect sPassword

    Application.CutCopyMode = False
    ActiveWorkbook.Close True

    Application.EnableEvents = True
    Application.ScreenUpdating = True
    Worksheets("Proc_Rnls").Range ("A:2")


    ThisWorkbook.Activate
    'Call CloseAll

    Application.ScreenUpdating = True
    MsgBox "Data has been successfully submitted to the data base"
    Application.CutCopyMode = False
    'Worksheets("COMM RNLS").Range("A3:K23") = ""

    End If

    End Sub
    Last edited by Erik88; 05-10-2011 at 10:11 AM.

  2. #2
    Forum Guru pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2010
    Posts
    5,154

    Re: Cut Filtered Data into Separate Workbook.

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
    regards pike

    If the solution helped please donate
    here to the RSPCA

    Sites worth visiting;

    J&R Solutions - royUK

    AJP Excel Information - Andy Pope

    Spreadsheet Toolbox

    VBA for smarties - snb

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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.2.0