Hi there
I have the following macro of which sorts my data and unprotects/protects.
Sub InsertRowAtChangeInValue()
ActiveSheet.Unprotect "Dreamct"
Range("A10:F371").Select
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Add Key:=Range("B10:B31") _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Sheet1").Sort
.SetRange Range("A10:F31")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
ActiveWorkbook.Save
Dim lRow As Long
For lRow = Cells(Cells.Rows.Count, "B").End(xlUp).Row To 2 Step -1
If Cells(lRow, "B") <> Cells(lRow - 1, "B") Then Rows(lRow).EntireRow.Insert
Next lRow
ActiveWorkbook.Save
ActiveSheet.Protect "Dreamct"
End Sub
When I have saved it and go to reopen it opens "read only". What im trying to do is to allow specific users to have full access to it and others read only.
How can I do this.
Thanks
I have the following macro of which sorts my data and unprotects/protects.
Sub InsertRowAtChangeInValue()
ActiveSheet.Unprotect "Dreamct"
Range("A10:F371").Select
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Add Key:=Range("B10:B31") _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Sheet1").Sort
.SetRange Range("A10:F31")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
ActiveWorkbook.Save
Dim lRow As Long
For lRow = Cells(Cells.Rows.Count, "B").End(xlUp).Row To 2 Step -1
If Cells(lRow, "B") <> Cells(lRow - 1, "B") Then Rows(lRow).EntireRow.Insert
Next lRow
ActiveWorkbook.Save
ActiveSheet.Protect "Dreamct"
End Sub
When I have saved it and go to reopen it opens "read only". What im trying to do is to allow specific users to have full access to it and others read only.
How can I do this.
Thanks