EliseFreedman
Programmer
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
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