Hi,

Yesterday, i had an issue:my userform was sending data to a single sheet "Base Dados". In the forum i was helped and now, the data is being sent auto in to 1 of 12 sheets (months).

This brought up a new problem. How can i define the valmax to the 12 new sheets?
this was the code i was using:
Function valmax()
Dim rng As Range

Set rng = ThisWorkbook.Sheets("Base Dados").Columns(1)
    valmax = Application.Max(rng)
End Function
I also have a similar problem with the protecting and unprotecting the sheets. Again, here's my actual code:
Sub desprotege()
   ThisWorkbook.Sheets("Base Dados").Unprotect "ncc"
    Application.EnableEvents = False
End Sub
Sub protege()
    Application.EnableEvents = True
    ThisWorkbook.Sheets("Base Dados").Protect "ncc", DrawingObjects:=True, Contents:=True, Scenarios:=True _
        , AllowFormattingColumns:=True, AllowFiltering:=True
   ThisWorkbook.Sheets("Base Dados").EnableSelection = xlUnlockedCells
     End Sub
thanks in advance for all the help you can give me.