Solved

VBA Excel - Runtime Error 438

Posted on 2014-10-31
2
1,971 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

809 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