Cougarina
07-17-2011, 05:03 AM
I'm working on a difficult workbook since I never know how many rows there will be. Since the users only should enter data in Sheet1 and on Sheet 2-4 only be able to fill in data in one cell, like E13. I protected the sheet except the cell where the user is able to enter data, which then calculates some money to dispense.
I copy the data to the other sheets when the user leaves the G column. No problems there.
I have this code.
Sub Skydda_Blad()
Dim wrbBok As Workbook
Dim wrsAktivtBlad As Worksheet, wsBlad As Worksheet
Set wrbBok = ActiveWorkbook
Set wrsAktivtBlad = ActiveSheet
'Loop through all sheets
For Each wsBlad In Worksheets
'Sheet that we wont protect
If wsBlad.Name = "Sheet1" Then GoTo NastaBlad
If wsBlad.Name <> wrsAktivtBlad.Name Then
wsBlad.Protect Password:="a1b2c3d4" ' not the actual password ;-)
End If
NastaBlad:
Next wsBlad
End Sub
This gives me a strange behavior that I get cells selected and then cant work, Excel won't let me change cell with tab or enter. Does anyone have a better code or any idea why excel behaves like this?
What I want is that the data from Sheet1 is copied to Sheet2-4 but the user should only be getting access to one cell.
Ask if it's unclear what I mean and I'll try to explain.:dunno
The use of this workbook is so complicated that I have problem explaining it even in my native language.
I copy the data to the other sheets when the user leaves the G column. No problems there.
I have this code.
Sub Skydda_Blad()
Dim wrbBok As Workbook
Dim wrsAktivtBlad As Worksheet, wsBlad As Worksheet
Set wrbBok = ActiveWorkbook
Set wrsAktivtBlad = ActiveSheet
'Loop through all sheets
For Each wsBlad In Worksheets
'Sheet that we wont protect
If wsBlad.Name = "Sheet1" Then GoTo NastaBlad
If wsBlad.Name <> wrsAktivtBlad.Name Then
wsBlad.Protect Password:="a1b2c3d4" ' not the actual password ;-)
End If
NastaBlad:
Next wsBlad
End Sub
This gives me a strange behavior that I get cells selected and then cant work, Excel won't let me change cell with tab or enter. Does anyone have a better code or any idea why excel behaves like this?
What I want is that the data from Sheet1 is copied to Sheet2-4 but the user should only be getting access to one cell.
Ask if it's unclear what I mean and I'll try to explain.:dunno
The use of this workbook is so complicated that I have problem explaining it even in my native language.