Code
Private Sub CommandButton1_Click()
Dim Actsheet As String
Application.ScreenUpdating = False
On Error Resume Next
ActiveWorkbook.Sheets("Material_50").Visible = True
ActiveWorkbook.Sheets("Material_50").Copy _
after:=ActiveWorkbook.Sheets("ZALOGA")
ActNm = ActiveSheet.Name
'ActiveSheet.Name = InputBox("")
Sheets(ActiveSheet.Name).Visible = True
ActiveWorkbook.Sheets("Material_50").Visible = False
Application.ScreenUpdating = True
'Make sure the name is valid
On Error Resume Next
'Get the new name
'Keep asking for name if name is invalid
Do
userInput = InputBox("Vnesi ime MATERIALA novega lista.") .......
'Insert the name of the new sheet
If StrPtr(userInput) = 0 Then
MsgBox "Stisnil si CANCEL- pobriši zavihek sam!!!" .......
'push CANCEL - but you should delete the tab by yourself
Application.DisplayAlerts = False
Exit Sub
Else
If userInput = vbNullString Then
MsgBox "Ne moreš nadaljevati brez vnesenega imena za ZALOGO!" .....
You cannot continue without insert new name of sheet
Else
ActiveSheet.Name = userInput
'MsgBox userInput & " entered."
End If
End If
Loop Until userInput <> vbNullString
Do Until Err.Number = 0
Err.Clear
ActiveSheet.Name = InputBox("Poskusi ponovno!" _ ..... try again
& vbCrLf & "Ime lahko že obstaja!" _ ..... name already exsist
& vbCrLf & "Prosim vnesi ime MATERIALA NOVEGA LISTA!!!") .... please inesrt new name of heet
Loop
On Error GoTo 0
Display More