Vba error - no cells found

Sunny2k19

New Member
Joined
Jan 14, 2019
Messages
1
Hi, can someone please advise what am I doing wrong here - when i run this code in excel it throws back an error saying 'No cells found' seems like code breaks at allranges(1).select
please note: this used to work fine before but since excel updated from 2010 to 2016. this issue has occurred. Thanks in advance!:)
Code im running is below:

'Recalculate/Resize Array after
Dim addIn As COMAddIn
Dim automationObject As Object
Set addIn = Application.COMAddIns("PI DataLink")
Set automationObject = addIn.Object
Dim allRanges(1 To 11) As Range
Dim i As Long
Set allRanges(1) = Range(theRange)



'For each DataLink array, select the top left cell, then select all cells in the array, and finally resize the array.
allRanges(1).Select

automationObject.ResizeRange
Worksheets("Alarms").Activate
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual

Worksheets("AlarmsDataDump").Activate

'Copy the Array as Hard Values so they can be manipulated for alarms

Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Columns("A:B").Select
Selection.Copy
Sheets("TempData").Select
Columns("A:B").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("AlarmsDataDump").Select
Columns("A:L").Select
Application.CutCopyMode = False
' Selection.ClearContents
Sheets("TempData").Select
Selection.Cut
Sheets("AlarmsDataDump").Select
Columns("A:B").Select
ActiveSheet.Paste

Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Add these three items you your debugger watch list

Code:
theRange
Range(theRange).Address
allRanges(1).Address

Then use the debugger to single step the code (F8) past this point
Code:
allRanges(1).Select

Then evaluate the values in the watch window to see why that statement is causing an error.
 
Upvote 0

Forum statistics

Threads
1,214,377
Messages
6,119,185
Members
448,872
Latest member
lcaw

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top