Hide Excel rows

Hi guys,

I have more than 50 rows in a worksheet where I want to show just the last 10 rows and hide rest of them.
Is this doable in uipath?
Thanks in advance.

Hi @kaurM ,

There is custom activities balareva Excel activities available in uipath market place which is having activity called hide rows. Could you try and let us know if it suits your requirement. Thanks.

Hi Thanks for your response but here we are allowed just to import Official packages.

Oh ok. In that case there is no other go. We should go with simple vb code to hide the rows in excel.

You have to use invoke code activity and use the below vb code to do the trick.

If you are using studio no issues or if you are using studiox you have to enable show developer filter in the activities panel to get the invoke code activity. Please try and let us know. And also import microsoft.office.interop.excel namespace to resolve the compilation errors. Thanks.

Dim excel As Microsoft.Office.Interop.Excel.Application
Dim wb1 As Microsoft.Office.Interop.Excel.Workbook
Dim ws1 As Microsoft.Office.Interop.Excel.Worksheet
excel = New Microsoft.Office.Interop.Excel.ApplicationClass
wb1 = excel.Workbooks.Open(Workbook1CopyFrom)
ws1 = CType(wb1.Sheets(Workbook1CopyFromSheet), Microsoft.Office.Interop.Excel.Worksheet)
ws1.Range(“A2:E40”).EntireRow.hidden = True
wb1.Save
wb1.Close
excel.Quit
ws1 = Nothing
wb1 = Nothing
excel = Nothing
GC.Collect

Hi,
This is giving me these errors:

Message: Error compiling code
error BC31539: Cannot find the interop type that matches the embedded type ‘Microsoft.Office.Interop.Excel._Application’. Are you missing an assembly reference? At line 1
error BC31539: Cannot find the interop type that matches the embedded type ‘Microsoft.Office.Interop.Excel.Workbooks’. Are you missing an assembly reference? At line 2
error BC31539: Cannot find the interop type that matches the embedded type ‘Microsoft.Office.Interop.Excel.Workbook’. Are you missing an assembly reference? At line 3
error BC30002: Type ‘Microsoft.Office.Interop.Excel.ApplicationClass’ is not defined. At line

Hi,

Please import package Microsoft.Office.Interop.Excel OR name space in to your process to resolve those errors.

I have already imported this namespace. Still giving error

@kaurM

Check below thread for your reference

Hope this will help you

Thanks

Thanks a lot. I found the solution from the thread you referred :slight_smile:

1 Like

Thanks so much for your response. It took me to the final solution :slight_smile:

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