Excel Column Data Type

Hello Team,

How could we modify macro Script to have different columns as No Format Data Type

In an Excel CSV File

Sub macro()
Range(“D:D”).Select 'specify the range which suits your purpose
With Selection
Selection.NumberFormat = “General”
.Value = .Value
End With
End Sub

Example

1)Column A Data Type as Number Format
2)Column C as Number Format
3)Column K as Number Format

Thanks Team in advance

Hi @NISHITHA

Can you try this

New Text Document.txt (528 Bytes)

or

You can try with Format Cells also

image

Regards,

@NISHITHA
you can achieve this by using the “Invoke VBA” activity to execute the provided VBA script in Excel. Here’s an example of how you can modify the VBA script to handle different columns:

vbaCopy code

Sub ModifyColumnFormats()
    ' Column A
    Columns("A:A").Select
    With Selection
        .NumberFormat = "General"
        .Value = .Value
    End With

    ' Column C
    Columns("C:C").Select
    With Selection
        .NumberFormat = "General"
        .Value = .Value
    End With

    ' Column K
    Columns("K:K").Select
    With Selection
        .NumberFormat = "General"
        .Value = .Value
    End With
End Sub

Now, to use this VBA script in UiPath, you can follow these steps:

  1. Use the “Invoke VBA” activity in your UiPath workflow.
  2. In the properties of the “Invoke VBA” activity, set the VbaProjectFile property to the path of your Excel file (if your macro is stored in the Excel workbook).
  3. Set the EntryPoint property to the name of the macro, in this case, “ModifyColumnFormats”.

Invoke VBA
VbaProjectFile: “path\to\your\Excel\File.xlsx”
EntryPoint: “ModifyColumnFormats”

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