Propósito

✔ Programação GLOBAL® - Quaisquer soluções e/ou desenvolvimento de aplicações pessoais, ou da empresa, que não constem neste Blog devem ser tratados como consultoria freelance. Queiram contatar-nos: brazilsalesforceeffectiveness@gmail.com | ESTE BLOG NÃO SE RESPONSABILIZA POR QUAISQUER DANOS PROVENIENTES DO USO DOS CÓDIGOS AQUI POSTADOS EM APLICAÇÕES PESSOAIS OU DE TERCEIROS.

Mostrando postagens com marcador Top Ten. Mostrar todas as postagens
Mostrando postagens com marcador Top Ten. Mostrar todas as postagens

VBA Excel - Exibe os primeiros 10% de um Range - Display Top Ten Percent in Ranges Programmatically

Inline image 1



Este exemplo mostra como usar o método AddTop10 para exibir os primeiro 10% de uma série de números numa planilha do MS Excel.

Sub DemoAddTop10() 
  ' Fill a range with random numbers. 
  ' Mark the top 10% of items in green, and the bottom 
  ' 10% of the items in red. 
  
  ' Set up a range, and fill it with random numbers. 
  Dim rng As Range 
  Set rng = Range("A1:E10") 
  SetupRangeData rng 
  
  ' Clear any existing format conditions. 
  rng.FormatConditions.Delete 
  
  ' Set up a condition that formats the top 
  ' 10 percent of items on green. 
  Dim fc As Top10 
  Set fc = rng.FormatConditions.AddTop10 
  fc.Percent = True 
  fc.TopBottom = xlTop10Top 
  fc.Interior.Color = vbGreen 
  
  ' Set up a condition that formats the bottom 
  ' 10 percent of items in red. 
  Set fc = rng.FormatConditions.AddTop10 
  fc.TopBottom = xlTop10Bottom 
  fc.Percent = True 
  fc.Interior.Color = vbRed 
End Sub 
Sub SetupRangeData(rng As Range) 
  rng.Formula = "=RANDBETWEEN(1, 100)" 
End Sub 

Tags: VBA, Excel, Display, Top Ten, Percent, Ranges, Programmatically
diHITT - Notícias