I'm trying to run a VB script which performs 1. Add a new column towards left (Position A) 2. Enter value of A1 as "1". 3. Fill down the series incrementing by 1 for all available rows (in Column B).
Actual Code:
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
Set objWB = objExcel.Workbooks.Open("XLSPATH")
Set objSheet = objwb.Sheets("SheetName")
objSheet.Columns("A:A").Insert xlToRight
objSheet.Cells(1, 1).Value = "Record Number"
objSheet.Cells(2, 1).Value = 1
Set Range = objSheet.Range("A2:A"&objSheet.UsedRange.Rows.Count)
Range.DataSeries xlColumns, xlLinear, xlDay, 1, False
objWB.Close True
objExcel.Quit
My script is failing at this command throwing error code '800A03EC'
Range.DataSeries xlColumns, xlLinear, xlDay, 1, False
But similar operation tried through a macro is working fine.
Range("A2:A10").Select
Selection.DataSeries Rowcol:=xlColumns, Type:=xlLinear, Date:=xlDay, _
Step:=1, Trend:=False**
I'm a beginner. Kindly help me catch the issue.