Thread: Set ws
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Per Jessen[_2_] Per Jessen[_2_] is offline
external usenet poster
 
Posts: 703
Default Set ws

Hi

I think "wbkOld.Activate" is the problem. Do you have assigned any
object to this variable, eg. set wbkOld = Workbooks("Book1")

Regards,
Per

On 12 Apr., 02:28, Karen53 wrote:
Hi,

I have two workbooks open and I am trying to set wsOld to a sheet in the old
workbook. *OldShName is a string variable containing the sheet code name of
the sheet I'm trying to set. *I keep getting an error stating an object is
required. *Is it because I am trying to use a string? *Is there a way to do
this?

* * * * wbkOld.Activate

* * * * If OldShName = "" Then
* * * * * * Set wsOld = ActiveSheet
* * * * Else
* * * * * * Set wsOld = Sheets(OldShName.Name)
* * * * End If

--
Thanks for your help.
Karen53