Possible?

  • Thread starter Thread starter B. Wassen
  • Start date Start date
Tom,

it works great! :)
Thanks.

But is it also possible to run it in a macro, and each time excel is started
the macro automaticly runs?

Another question.....

I have a form in wich the user must fill data.
For instance in A1, A2, A3, F7
Is it possible that after input from A3 to jump to F7?

Ben
 
Use the Workbook_Open event. You go into the vbe and right click on the
thisworkbook entry in your project in the project explorer, selecting view
code. In the resulting module, select Workbook from the left dropdown at the
top and Open from the left one.

Private Sub Workbook_Open()

End Sub

Put your code in this procedure or call it from this procedure.

If you want to allow the user to make entries, lock all cells but the ones
where the entries will be made - those should be unlocked. Then protect the
sheet. for the sheet, set EnableSelection = xlUnlockedCells

But, this will allow the curor to be shown - you can't have it both ways.
 
Tom,

It looks like this right now :

Private Sub Workbook_Open()

Selection.Locked = True
Selection.FormulaHidden = True
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True

End Sub

But when I open Excel it gives an error at Selection.Locked = True


Ben
 
Private Sub Workbook_Open()
Worksheets("Sheet1").Activate
worksheets("Sheet1").Cells
.Locked = True
.FormulaHidden = True
.Protect DrawingObjects:=True, _
Contents:=True, Scenarios:=True
.Parent.EnableSelection = xlNoSelection
End With
End Sub
 
Left out the With statement

Private Sub Workbook_Open()
Worksheets("Sheet1").Activate
With worksheets("Sheet1").Cells
.Locked = True
.FormulaHidden = True
.Protect DrawingObjects:=True, _
Contents:=True, Scenarios:=True
.Parent.EnableSelection = xlNoSelection
End With
End Sub
 
Tom,

it's strange? But it doesn't work with that code.
But when I only have the following,

Private Sub Workbook_Open() .Parent.EnableSelection = xlNoSelection
End Sub

it works fine :)

So thanks anyway

Ben
 
Back
Top