Pagina precedente | 1 | Pagina successiva
Vota | Stampa | Notifica email    
Autore

macro colorare fogli

Ultimo Aggiornamento: 06/03/2017 20:26
Post: 390
Registrato il: 28/05/2011
Città: MILANO
Età: 43
Utente Senior
excel 2000/2007
OFFLINE
05/03/2017 22:09

Ciao queste 2 macro allegate:
Sub rename_Sheet
Sub rename_Sheet_dopo_reset

Option Explicit

Sub rename_Sheet()

Dim OldName As String
Dim avviso, rese As String

ActiveWorkbook.Unprotect "123456"

OldName = ActiveSheet.Name
On Error Resume Next

Application.ScreenUpdating = False

rese = ActiveSheet.Range("R12").Value

 avviso = MsgBox("Sign. " & Environ("UserName") & " rinomino il foglio in < " & rese & " > ?", _
 vbExclamation + vbYesNo + vbDefaultButton2, "AVVISO")
 
 If avviso = 7 Then Exit Sub
     
ActiveSheet.Name = ActiveSheet.Range("R12").Value

On Error GoTo 0
If OldName = ActiveSheet.Name Then
  
        
    avviso = MsgBox("Sign. " & Environ("UserName") & " il foglio è già stato rinominato, " & Chr(13) & "o nome ripetuto o inserito carattere non valido!", _
 vbExclamation, "AVVISO")
 
 If avviso = 7 Then Exit Sub
    
    
End If


ActiveWorkbook.Protect "123456"

End Sub



Sub rename_Sheet_dopo_reset()
'tutto il foglio

Dim OldName As String
Dim avviso As String

ActiveWorkbook.Unprotect "123456"

OldName = ActiveSheet.Name
On Error Resume Next
     
ActiveSheet.Name = ActiveSheet.Range("U13").Value

On Error GoTo 0
If OldName = ActiveSheet.Name Then
       
    
End If

ActiveWorkbook.Protect "123456"

End Sub



cambiano il nome ai fogli.
Chiedo un aiuto per:
aggiungere a < Sub rename_Sheet > "colorare il foglio secondo il colore inserito nella cella U14"
aggiungere a < rename_Sheet_dopo_reset > "togliere il colore al foglio"
Spero di essermi spiegato.
Un grazie in anticipo.
john


---------------
excel 2007
Post: 3.750
Registrato il: 13/03/2012
Città: LIVORNO
Età: 78
Utente Master
2010
OFFLINE
05/03/2017 22:23

per colorare il foglio intendi il tab ? in questo caso
ActiveSheet.Name = ActiveSheet.Range("R12").Value
ActiveSheet.Tab.ColorIndex = Range("U14").Value
[Modificato da patel45 05/03/2017 22:30]

----------
Win 10 - Excel 2010
allega un file di esempio, guadagnerai tempo tu e lo farai risparmiare a chi ti aiuta
Post: 390
Registrato il: 28/05/2011
Città: MILANO
Età: 43
Utente Senior
excel 2000/2007
OFFLINE
06/03/2017 20:26

Grazie patel,
è o.k. [SM=g27811]
Un saluto.
john
---------------
excel 2007
Vota:
Amministra Discussione: | Chiudi | Sposta | Cancella | Modifica | Notifica email Pagina precedente | 1 | Pagina successiva
Nuova Discussione
 | 
Rispondi
Cerca nel forum
Tag discussione
Discussioni Simili   [vedi tutte]
Feed | Forum | Bacheca | Album | Utenti | Cerca | Login | Registrati | Amministra
Tutti gli orari sono GMT+01:00. Adesso sono le 17:47. Versione: Stampabile | Mobile | Regolamento | Privacy
FreeForumZone [v.6.1] - Copyright © 2000-2024 FFZ srl - www.freeforumzone.com