LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ian Ian is offline
external usenet poster
 
Posts: 238
Default Code runs in wrong workbook?

I'm having trouble getting my head round a problem I'm having with some
code.

I have created a userform in a workbook (let's call this workbook1) which
requires users to enter data which is then used to configure a worksheet.
There are 2 worksheets, the one called Lookup is hidden and the forms refers
to this one to find data for comboboxes. The userform then configures the
Machine worksheet and the userform is hidden.

My problem arises (sometimes) when I have workbook1 open, but I am working
on another workbook (say workbook2). I can't remember the exact error I get,
but when I debug, it takes me to one of the lines in the workbook1 form's
code referring to the range in Lookup for a combobox.

I'm guessing the reason I'm getting an error is because workbook2 does not
have a sheet called Lookup.

Can anyone offer a reason for this happeneing? Is there a way to render the
code in the userform inoperative when the form is hidden?

Workbook1 is actually saved as a template so, once the form has finished
taking data and has been hidden, there will never be a use for it again. Can
the entire form be deleted in code?

I could post some of the code, but I'm not sure which bits are relevant.

--
Ian
--


 
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
vba code runs...need spaces ........ Wanna Learn Excel Discussion (Misc queries) 2 January 20th 09 12:44 PM
Code only runs once Kent Excel Programming 3 November 24th 05 03:47 PM
Code runs in 2002 but not in 97!? Big Chris[_39_] Excel Programming 4 August 25th 05 12:22 PM
Code slows down after a few runs Diverse Computing[_2_] Excel Programming 2 July 21st 05 04:08 AM
How to keep from going dizzy when my code runs TBA[_2_] Excel Programming 3 September 23rd 03 11:33 PM


All times are GMT +1. The time now is 10:12 PM.

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"