Solved

VBA Excel - Runtime Error 438

Posted on 2014-10-31
2
1,977 Views
Last Modified: 2014-10-31
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
0
Comment
Question by:prosit
2 Comments
 
LVL 5

Accepted Solution

by:
ReneD100 earned 500 total points
ID: 40415570
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
 
LVL 2

Author Closing Comment

by:prosit
ID: 40415601
yes yes :)

thank you!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question