Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88809

DataSeries method of Range class failed

$
0
0

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.


Viewing all articles
Browse latest Browse all 88809

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>