Below is the one line code i have written to move sheet named ‘Final’ at the end,
Getting this error
Kindly help if i need to pass something in the Edit arguments tab. Thank you
Below is the one line code i have written to move sheet named ‘Final’ at the end,
Getting this error
Kindly help if i need to pass something in the Edit arguments tab. Thank you
Check out this link
https://www.extendoffice.com/documents/excel/3155-excel-move-sheet-to-end-front.html
Chout this docs
https://docs.uipath.com/activities/other/latest/workflow/invoke-vb-script
Regards
Gokul
what exactly do i need to pass in Invoked code argument? Name: Worksheets? what should be the Type and value?
I did go through this… got the vba code from the first link, but not able to understand how to use the same in Invoke VBA code activity…
Hi Sudharshan,
Any help on this? thank you
@rodrigo.simao Hi Rodrigo… any help on this?
Hello @Nishant_mantri, I’m currently trying to figure it out…
@Nishant_mantri
try this
Sub MoveWorksheet()
Worksheets(“final”).Move After:=Worksheets(Worksheets.Count)
End Sub
refer this
that is just the VBA code to move the sheet to the end, i need to use that in the Invoke code activity in UiPath… not able to do it… I did go through the link which you have posted, there is no solution in that…
You can also use macros, Try like this
Here is the script
MoveSheet.vb (202 Bytes)
Make sure that this option is enabled
Regards
Sudharsan
Try this by using Invoke Code activity
You can try this way also by using Excel Invoke VBA activity
Code:
Sub MoveSheetToEnd()
Dim ws As Worksheet
Set ws = ThisWorkbook.Sheets("Sheet3") ' Replace "SheetName" with the name of the sheet you want to move
' Move the sheet to the end
ws.Move After:=ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count)
End Sub
BlankProcess13.zip (51.8 KB)
Works perfect… Thanks a lot…
However, if my workbook is already opened what changes I need to make to the code, I think i need to set work book to Activeworkbook, i tried but i think my syntax is incorrect, getting exception for the same.
Try this
Sub MoveSheetToEnd()
Dim ws As Worksheet
Dim activeWorkbook As Workbook
' Set the active workbook
Set activeWorkbook = ActiveWorkbook
' Replace "SheetName" with the name of the sheet you want to move
Set ws = activeWorkbook.Sheets("SheetName")
' Move the sheet to the end
ws.Move After:=activeWorkbook.Sheets(activeWorkbook.Sheets.Count)
End Sub
Perfect… no need to open workbook as this is inside use excel scope… Thank you Irtetala
Hope it’s clarified @Nishant_mantri
If yes would suggest to close this topic