Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select a cell on another spreadsheet

Status
Not open for further replies.

EliseFreedman

Programmer
Dec 6, 2002
470
GB
Hi There

I am using Code to automatically import some data from a text file. The code is contained within a module and i then use the following line to call the code

<code>
ImportTextFile "h:\Referral", ","
</code>

I want to be able to click a button on my main spreadsheet which then sets the focus to a specific cell (a1) on worksheet 2 before importing the file.

I had amended my code to the following

<code>
Sheets("Sheet2").Select
Range("A2").Select

ImportTextFile "h:\Referral", ","
End Sub

</code>

However, I am getting an error message

<code>
Run time error 1004
Select Method of Range class failed
<code>

How do I solve this

Elise
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top