Create Table in Excel Worksheet using VBA

excel
studio

#1

Hi,
I need to execute following code using invoke code activity. Someone, please guide me.

Sub DynamicRange()
'Best used when first column has value on last row and first row has a value in the last column

Dim sht As Worksheet
Dim LastRow As Long
Dim LastColumn As Long
Dim StartCell As Range

Set sht = Worksheets("Sheet1")
Set StartCell = Range("D9")

'Find Last Row and Column
  LastRow = sht.Cells(sht.Rows.Count, StartCell.Column).End(xlUp).Row
  LastColumn = sht.Cells(StartCell.Row, sht.Columns.Count).End(xlToLeft).Column

'Select Range
  sht.Range(StartCell, sht.Cells(LastRow, LastColumn)).Select

End Sub

#2

I found the solution by using Invoke VBS :smiley:


#3

Is “Invoke VBS” an UiPath activity? Cant find it. Do we need any package to be installed for this? Please assist.


#4

#5

@vvaidya Thank you for the quick response…


#6

Update the Excel activity package