v1.0
Comando

CellCommand()

Executa uma ação em um intervalo de células da planilha ativa: copiar, colar, limpar, definir valor, formatar (fonte, alinhamento, borda, preenchimento), mesclar, aplicar fórmula ou estilo de tabela.
Sintaxe
CellCommand(comando, celulas [, param [, appId]])

Parâmetros

ParâmetroObrigatórioDescrição
comandoSim Copy – copia o intervalo para o clipboard.
Cut – recorta o intervalo.
Clear – limpa conteúdo e formatação.
ClearFormats – limpa apenas a formatação.
Select – seleciona o intervalo.
AutoFill – preenche automaticamente até a última linha usada.
Merge – mescla as células do intervalo.
Paste – cola; param: All, Values, Formats, Formulas, Comments, Validation, AllExceptBorders, AllMergingConditionalFormats, AllUsingSourceTheme, ColumnWidths, FormulasAndNumberFormats, ValuesAndNumberFormats (vazio = colar tudo).
SetValue – define valor; param: valor a definir.
NumberFormat – define formato numérico; param: General, @, DD/MM/YYYY, hh:mm:ss, 0.00%, #,##0.00, etc.
Font – define fonte; param: NomeFonte tamanho cor [Bold] [Italic] [Underline].
Align – define alinhamento; param: [Left|Center|Right|Justify] [Top|Center|Bottom|Justify].
Border – define borda; param: [All|Left|Top|Right|Bottom] [Continuous|Dash|DashDot|DashDotDot|Dot|Double|SlantDashDot] [espessura] [cor].
Fill – define cor de preenchimento; param: nome de cor CSS ou hex #RRGGBB.
SetFormula – define fórmula de array; param: fórmula Excel.
TableStyle – aplica estilo de tabela; param: nome do estilo (ex: TableStyleLight2).
celulasSimRange. Ex: 'A1', 'A1:Z100', 'B2:D10'.
paramCondicionalParâmetro adicional exigido por alguns comandos (ver coluna Comando acima).
appIdNãoIdentificador da instância Excel gerenciada.

Exemplos

AthusScript
// Definir valor em célula:
CellCommand(SetValue, 'A1', 'Nome')
CellCommand(SetValue, 'B1', $valor)

// Definir fórmula:
CellCommand(SetFormula, 'C1', '=A1+B1')

// Formatar número:
CellCommand(NumberFormat, 'B:B', '#,##0.00')
CellCommand(NumberFormat, 'C1:C100', 'DD/MM/YYYY')

// Definir fonte (Nome Tamanho Cor [Bold] [Italic]):
CellCommand(Font, 'A1:Z1', 'Arial 12 Black Bold')

// Alinhamento horizontal e vertical:
CellCommand(Align, 'A1:Z1', 'Center Top')

// Borda (lado estilo espessura cor):
CellCommand(Border, 'A1:Z100', 'All Continuous 1 Black')

// Cor de preenchimento:
CellCommand(Fill, 'A1:Z1', '#4472C4')
CellCommand(Fill, 'A1:Z1', 'LightBlue')

// Copiar e colar apenas valores:
CellCommand(Copy, 'A1:D100')
CellCommand(Paste, 'F1', 'Values')

// Mesclar células:
CellCommand(Merge, 'A1:D1')

// Aplicar estilo de tabela:
CellCommand(TableStyle, 'A1:D100', 'TableStyleMedium2')