How to set specific excel sheet as first sheet

I have 21 sheets I want to set 21st sheet as 1st sheet in excel file
how to set the sheet in excel file at first?

Hi @anjani_priya,

Thanks for reaching out UiPath Community.

Can you please mention which approach you are following?

Happy Automation,
@Vinit_Kawle

I need to rearrange the index of the excel sheet in excel file

Hi @anjani_priya

Sub MoveSheetToFirst()
    Sheets(21).Move Before:=Sheets(1)
End Sub

Hope it helps!!

Hi @anjani_priya

Can you try the following?

Move Sheet.txt (73 Bytes)

Hope this helps!!

Hi @anjani_priya

Sub MoveSheetToFirst()
    Sheets(21).Move Before:=Sheets(1)
End Sub

Sample Data in Sheet 21


Output:

Code File:
VBA Code.txt (72 Bytes)

Hope it helps!!

Is Sheets21 and sheet1 are the sheet names?

how does sheets(21) and sheets(1) refer to?

actually there are 21 sheets after 21 sheets there is a summary sheet i want get that summary sheet to first how to declare that

Hi @anjani_priya

Try this:

Sub MoveSheetToFirst()
    Sheets(22).Move Before:=Sheets(1)
End Sub

Hope it helps

@anjani_priya
Instead of sheet 21 insert sheet 22 in the text file

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