Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default change worksheets through code

I have an excel program that uses code to retrieve values from on sheet for
use in a function or sub. The code worked fine but has stoped. This code
snippit Sheets(REPORTSHEET).Activate
sCE = ActiveSheet.Cells(CER, CEC).Value Worked fine but now I find that the
reports sheet is not being activated if the user is on a different sheet when
he calls the sub or function. (CER and CEC are defined as constants to make
it easy to change the layout of a report). One possible problem could be that
part of the program was developed on Office 2003 and part was developed on
Office 2000. I can use all the help I can get on this one it has been driving
me crazy a short trip but not much fun. Thanks Mike

  #2   Report Post  
Posted to microsoft.public.excel.programming
NC NC is offline
external usenet poster
 
Posts: 7
Default change worksheets through code

Mike

is the reportsheet name of the sheet you want to activate then" " are
missing whwn you are calling it
the right code would be sheets("re
portsheet").activate

if you are using reportsheet as sheet index then check the index of
sheet in workbook.

Regards
NC

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default change worksheets through code

MikeD wrote:
I have an excel program that uses code to retrieve values from on sheet for
use in a function or sub. The code worked fine but has stoped. This code
snippit Sheets(REPORTSHEET).Activate
sCE = ActiveSheet.Cells(CER, CEC).Value Worked fine but now I find that the
reports sheet is not being activated if the user is on a different sheet when
he calls the sub or function. (CER and CEC are defined as constants to make
it easy to change the layout of a report). One possible problem could be that
part of the program was developed on Office 2003 and part was developed on
Office 2000. I can use all the help I can get on this one it has been driving
me crazy a short trip but not much fun. Thanks Mike

Hi Mike
If a user is on a different sheet then that is the active sheet.

Instead of sCE = ActiveSheet.Cells(CER, CEC).Value
try
sCE = sheets("ReportSheet").Cells(CER, CEC).Value
then reportsheet doesn't have to be the active sheet.

HTH

Andrew Bourke
Reply
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
Code for multiple worksheets Paul S Excel Discussion (Misc queries) 1 June 17th 08 12:50 PM
Combine Worksheets - help with Code! CherylH Excel Discussion (Misc queries) 1 September 13th 07 03:45 PM
Adding code to worksheets mgs[_2_] Excel Programming 0 January 4th 04 11:33 PM
Change code to make worksheets instead of workbooks mikeb1[_4_] Excel Programming 3 December 15th 03 03:23 PM
Need code to protect worksheets - amount of worksheets varies Sandy[_3_] Excel Programming 1 September 9th 03 02:17 AM


All times are GMT +1. The time now is 04:16 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"