View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
engineer[_3_] engineer[_3_] is offline
external usenet poster
 
Posts: 1
Default Excel VBA - Storing text in a variable, and "'Cells' of object _Global failed"

Okay, tried Stephen Bullen's method from another thread, and it work
fine!

You haven't fully-qualified the Cells calls:

Set srceRange = Sheetbasis.Range(Sheetbasis.Cells(2, 2), _
Sheetbasis.Cells(8, 2))

Or:

With Sheetbasis
Set srceRange = .Range(.Cells(2, 2), .Cells(8, 2))
End With


So simply adding the spreadsheet name before the range and cell
works:

With ActiveSheet
ID = .Range(.Cells(Start, 1), .Cells(Start, 1))
End With

This frustrating part of this is that at other times the code work
without fully qualifying the range and cells.

Sorry to waste anyone's time..

--
Message posted from http://www.ExcelForum.com