LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 144
Default Setting a variable = ActiveWorkbook

I know this should be simple, but I'm pretty new to VBA and can't seem to get
it to work. My code:

Dim myWbk as Workbook
Dim ws1 as Worksheet
Dim ws2 as Worksheet
Set myWkb = ActiveWorkbook

It never sets the value of the variable, so when I try:

Set ws1 = myWbk.Worksheets("Individuals")

I get "Run Time Error 91 - Object variable or With block variable not set"

What in the world am I doing wrong?

Thanks,

Cheryl
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
variable not defined, ActiveWorkbook.name Janis Excel Programming 1 September 1st 06 08:30 PM
set variable to activeworkbook davegb Excel Programming 2 May 24th 06 08:21 PM
Setting a Variable range in VBA The Hawk Excel Programming 2 May 5th 06 03:11 AM
'ActiveWorkbook.Names.Add Name:' how to make range variable? TeeSea Excel Programming 1 June 9th 05 03:42 PM
setting a range variable equal to the value of a string variable Pilgrim Excel Programming 2 July 1st 04 11:32 PM


All times are GMT +1. The time now is 11:23 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"