Tempo de leitura: 1 minuto
Adicionar 52 Excel folhas de planilhas semanas do ano Excel VBA
Esta macro Excel VBA usando a instrução For Next vamos inserir 52 planilhas referente as 52 semanas do ano, abaixo fizemos um outro macro para deletar todas as folhas de planilhas e preservar apenas um com determinado
‘Option Private Module
Sub sbx_semanas_do_ano()
On Error Resume Next
Dim i As Integer
If TypeName(Selection) <> “Range” Then
MsgBox “Type selecionado não Range!”, vbCritical
Exit Sub
End If
Application.ScreenUpdating = False
For i = 1 To 52
ActiveWorkbook.Sheets.Add
With ActiveSheet
.Move After:=Sheets(Sheets.Count)
.Name = “Semana Nº ” & i
End With
Set wkf = Application.WorksheetFunction
wCor = wkf.RandBetween(3, 56)
ActiveWorkbook.Sheets(i).Tab.ColorIndex = wCor
Next i
Planilha27.Select
sbx_msg_volatil
End Sub
Sub sbx_msg_volatil()
CreateObject(“WScript.Shell”).Popup “Aprenda Excel VBA – com a Coleção de 30.000 Macros!” & vbCrLf & _
“Aguarde mensagem temporária”, 1, “Saberexcel.com.br”
End Sub
Sub sbx_deletar_todas()
Dim wPlan As Worksheet
If Sheets.Count = 1 Then MsgBox “Não há o que deletar…!”, vbCritical, “Escola SaberExcel VBA Estudos: Exit Sub”
For Each wPlan In Worksheets
‘impede de emitir a mensagem se deseja excluir
Application.DisplayAlerts = False
If wPlan.Name <> “Principal” Then
wPlan.Delete
End If
Next
Planilha27.Select
sbx_msg_volatil
Application.DisplayAlerts = True
End Sub

Faça o Download do exemplo de Planilha
Link permanente
Prezado
Como posso alterar uma forma “Elipse” de cor conforme valor da range:
Exemplo
Elipe “Vermelha” > 0,80 e < 0.99.
Agradeço no que pude me ajudar.
Oziel