anand3dinesh
Board Regular
- Joined
- Dec 19, 2019
- Messages
- 137
- Office Version
- 365
- Platform
- Windows
Hi All,
I have below code to assign range of cells value into Arr variable.
where Arr is variant, not sure what causing "vba ERROR 1004 method range of object_worksheet failed".
could you please help me to fix this?
Thanks in advance, Please see below code. error is in red line below
Dim wKPI As Workbook
Dim wKPIsh As Worksheet
Dim Arr as Variant
For Each wKPIsh In wKPI.Worksheets
cKPI_Lcol = cKPIsh.Range("XFD7").End(xlToLeft).Column
If cKPIsh.Name = wKPIsh.Name Then
'Declare Last row variables
wKPI_Lrow = wKPIsh.Range("B1048576").End(xlUp).Row
wKPI_Lcol = wKPIsh.Range("XFD7").End(xlToLeft).Column
For wKPIr = 8 To wKPI_Lcol
Arr = wKPIsh.Range(Cells(wKPIr, 2), Cells(wKPIr, wKPI_Lcol)).Value
I have below code to assign range of cells value into Arr variable.
where Arr is variant, not sure what causing "vba ERROR 1004 method range of object_worksheet failed".
could you please help me to fix this?
Thanks in advance, Please see below code. error is in red line below
Dim wKPI As Workbook
Dim wKPIsh As Worksheet
Dim Arr as Variant
For Each wKPIsh In wKPI.Worksheets
cKPI_Lcol = cKPIsh.Range("XFD7").End(xlToLeft).Column
If cKPIsh.Name = wKPIsh.Name Then
'Declare Last row variables
wKPI_Lrow = wKPIsh.Range("B1048576").End(xlUp).Row
wKPI_Lcol = wKPIsh.Range("XFD7").End(xlToLeft).Column
For wKPIr = 8 To wKPI_Lcol
Arr = wKPIsh.Range(Cells(wKPIr, 2), Cells(wKPIr, wKPI_Lcol)).Value