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.
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
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks