Dark0Prince
Active Member
- Joined
- Feb 17, 2016
- Messages
- 433
Code:
Sub VOPSRELATIVE()
'
' VOPSRELATIVE Macro
'
' Keyboard Shortcut: Ctrl+Shift+R
'
Number = ActiveSheet.Cells(14, 1)
lastrow = 13
For Each c In Range(Cells(14, 1), Cells(Cells(Rows.Count, 1).End(xlUp).Row, 1))
If Number <> c Then Exit For
lastrow = lastrow + 1
Next
If lastrow = 13 Then Exit Sub
Range("A1:M" & lastrow).Copy
Workbooks.Add
ActiveSheet.Paste
Workbooks("DISP FORM - BLANK.xlsm").Sheets(2).Rows("14:" & lastrow).EntireRow.Delete
Range("A2").Activate
Columns("A:L").EntireColumn.AutoFit
Columns("A:A").Select
Range("A2").Activate
Selection.ColumnWidth = 10.5
Range("F14").Select
Application.CutCopyMode = False
Selection.Copy
Range("A7").Select
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveWorkbook.Password = "SECRET"
Columns(6).EntireColumn.Delete
Range("A7:K7").Select
Selection.Copy
End Sub
This code creates a new workbook and pw protects it no matter what client number is contained in the new workbook. I think the best way to do this is to add a sheet in excel that lists all the client numbers that I don't want to be password protected. Then if they exist on the new workbook I want it to skip the line " ActiveWorkbook.Password = "SECRET" ". How can I add this IF statement?