View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Cheryl Cheryl is offline
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