VBA Excel - Runtime Error 438

Hi,

I have this code for which I'm trying to define a range to search in, but it gives me the runtime error above.  

What I'm trying to accomplish is to open ANOTHER spreadsheet, search for a value and paste other values based on that.

 
   Dim wb As Workbook
    
    Set wb = Workbooks.Open("c:\Original.xlsx")
    Set ws2 = wb.Sheets("FS_ITEM") 

    With ws2(1).Range("a2:amq2")

Open in new window


I've tried a smaller range, different sheets, books etc.  Must be something I've overlooked.

tnx
~j
LVL 2
prositAsked:
Who is Participating?
 
ReneD100Connect With a Mentor Commented:
ws2 is a workbook object. This object does not have an index so ws2(1) does not make any sense. ws2.range("a2:amq2") should work.
0
 
prositAuthor Commented:
yes yes :)

thank you!
0
All Courses

From novice to tech pro — start learning today.