How to change Excel's cell format to Custom?

Hi Team,

How can I change the format of Excel cell/whole column using UiPath Studio ?

I need to make the column’s format to custom: _( #,##0_);_( (#,##0);(* “-”??);(@)**

Please note: Using 3rd party package is not allowed.



Could you please explain a bit more?

If possible please provide the input format and also expected format in Excel


@THIRU_NANI Thanks for responding.

I am getting one input file (client file) as an excel where I need to perform VLOOKUP formula in cell (using studio) , but the format of the cell should be custom ( _( #,##0_);_( (#,##0);( “-”??* );(@ )).

By default it is coming as General

  1. save below code to text file e.g. vba.txt
  2. in excel application scope, call invoke VBA
    set function name = ChangeColumnFormat
    entry method parameters= {sheet name, column letter to change format}
    e.g. {"Sheet1", "B"}
Function ChangeColumnFormat(sheetName As String, columnLetter As String)
    Columns(columnLetter & ":" & columnLetter).Select
    Selection.NumberFormat = "_( #,##0_);_( (#,##0);(* ¡°-¡±??);(@)"
End Function
1 Like

It’s working. Thanks for the solution @jack.chan :slight_smile:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.