ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Problem activating a sheet (https://www.excelbanter.com/excel-programming/288380-problem-activating-sheet.html)

jowatkins[_6_]

Problem activating a sheet
 
Hi,

I want to activate a sheet in Run time. Can anyone explain to me wh
of the following two bits of code, the first one work but the secon
doesn't.

Set monthSheet = baseBook.Sheets("Month")
monthSheet.Activate

Set currSheet = baseBook.Sheets(sheet)
currSheet.Activate - error message "Out of Range"

Cheers, J

--
Message posted from http://www.ExcelForum.com


Bob Phillips[_6_]

Problem activating a sheet
 
Because you haven't enclosed sheet in quotes, so it is looking for a
variable called sheet, which is probably empty?

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"jowatkins " wrote in message
...
Hi,

I want to activate a sheet in Run time. Can anyone explain to me why
of the following two bits of code, the first one work but the second
doesn't.

Set monthSheet = baseBook.Sheets("Month")
monthSheet.Activate

Set currSheet = baseBook.Sheets(sheet)
currSheet.Activate - error message "Out of Range"

Cheers, Jo


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 06:49 AM.

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