ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   macro (https://www.excelbanter.com/excel-programming/301434-macro.html)

Christopher Brooks[_4_]

macro
 
Hello,

Why does this code hang on Range("A1:D205").Select
? I got it by running a macro.


Set WB = Workbooks.Open(fileName:=FName)
WB.Activate
Range("A1:D205").Select

Thanks.

-cnb

No Name

macro
 
Try adding 'Activesheet." before range

The code should be Activesheet.Range("A1:D205").select
-----Original Message-----
Hello,

Why does this code hang on Range("A1:D205").Select
? I got it by running a macro.


Set WB = Workbooks.Open(fileName:=FName)
WB.Activate
Range("A1:D205").Select

Thanks.

-cnb
.


Earl Kiosterud[_3_]

macro
 
Christopher,

Some possibilities"

Since no sheet is specified, whichever sheet was active when workbook FName
was last saved is the sheet that will be used. If it's a chart sheet, the
Select will fail.

There may be a scroll range set that's inside the range of A1:D205

--
Earl Kiosterud
mvpearl omitthisword at verizon period net
-------------------------------------------

"Christopher Brooks" wrote in message
...
Hello,

Why does this code hang on Range("A1:D205").Select
? I got it by running a macro.


Set WB = Workbooks.Open(fileName:=FName)
WB.Activate
Range("A1:D205").Select

Thanks.

-cnb





All times are GMT +1. The time now is 09:25 PM.

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