ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   error 400 (https://www.excelbanter.com/excel-programming/319912-error-400-a.html)

JoeBo

error 400
 
I open a workbook with vba, I then wish to copy data from the sheet to the
host workbook. This works fine until I attempt to select a range in the
opened sheet:

Workbooks.Open FileName:=FileName


Windows(FileName).Activate
Range("B7:E18").Select

The range select causes an error 400. Is this because the I am not opening
the file with read write permissions?
Anyone help with this.
Thanks
--
JoeBo

JoeBo

error 400
 
Found the answer.
I was not specifying the sheet. instead of

Range("B7:E18").Select
I should have put:

ActiveSheet.Range("B7:E18").Select


"JoeBo" wrote:

I open a workbook with vba, I then wish to copy data from the sheet to the
host workbook. This works fine until I attempt to select a range in the
opened sheet:

Workbooks.Open FileName:=FileName


Windows(FileName).Activate
Range("B7:E18").Select

The range select causes an error 400. Is this because the I am not opening
the file with read write permissions?
Anyone help with this.
Thanks
--
JoeBo



All times are GMT +1. The time now is 09:45 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com