Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Check if the first sheet is the selected sheet

Hello everyone,

I have a program that opens an excel template and then checks to see if
the first sheet is selected, if it is then no error but i get an error
irrespective of the fact whether the first is selected or not...i am
pasting the code here and would appreciate it if someone can point what
i am missing.

TIA

#region Excel Check 5: First sheet or multiple sheets selected

if(OptionsData.XLCheckSelectedSheet)----(bool)
{

if(XLwb.Sheets.Count 1 && XLwb.ActiveSheet !=
XLwb.Sheets.get_Item(1))
{
ErrorCounter++;
ProcessError(ErrorCounter, "The first sheet is not the selected
sheet");
}

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Check if the first sheet is the selected sheet

why dont you activate the first sheet after opening the file. This will
solve the problem of error because you then dont need to have this code
in your workbook.

melody wrote:
Hello everyone,

I have a program that opens an excel template and then checks to see if
the first sheet is selected, if it is then no error but i get an error
irrespective of the fact whether the first is selected or not...i am
pasting the code here and would appreciate it if someone can point what
i am missing.

TIA

#region Excel Check 5: First sheet or multiple sheets selected

if(OptionsData.XLCheckSelectedSheet)----(bool)
{

if(XLwb.Sheets.Count 1 && XLwb.ActiveSheet !=
XLwb.Sheets.get_Item(1))
{
ErrorCounter++;
ProcessError(ErrorCounter, "The first sheet is not the selected
sheet");
}


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Check if the first sheet is the selected sheet

thanks sonu,I cant do that because this a tool that is testing a
template to test certain test criteria...
if i activate the first sheet then i will be doing it programatcally
and that is not the intention...

sonu wrote:
why dont you activate the first sheet after opening the file. This will
solve the problem of error because you then dont need to have this code
in your workbook.

melody wrote:
Hello everyone,

I have a program that opens an excel template and then checks to see if
the first sheet is selected, if it is then no error but i get an error
irrespective of the fact whether the first is selected or not...i am
pasting the code here and would appreciate it if someone can point what
i am missing.

TIA

#region Excel Check 5: First sheet or multiple sheets selected

if(OptionsData.XLCheckSelectedSheet)----(bool)
{

if(XLwb.Sheets.Count 1 && XLwb.ActiveSheet !=
XLwb.Sheets.get_Item(1))
{
ErrorCounter++;
ProcessError(ErrorCounter, "The first sheet is not the selected
sheet");
}


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Check if the first sheet is the selected sheet

Check if the activesheet index is 1.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"melody" wrote in message
ups.com...
thanks sonu,I cant do that because this a tool that is testing a
template to test certain test criteria...
if i activate the first sheet then i will be doing it programatcally
and that is not the intention...

sonu wrote:
why dont you activate the first sheet after opening the file. This will
solve the problem of error because you then dont need to have this code
in your workbook.

melody wrote:
Hello everyone,

I have a program that opens an excel template and then checks to see

if
the first sheet is selected, if it is then no error but i get an error
irrespective of the fact whether the first is selected or not...i am
pasting the code here and would appreciate it if someone can point

what
i am missing.

TIA

#region Excel Check 5: First sheet or multiple sheets selected

if(OptionsData.XLCheckSelectedSheet)----(bool)
{

if(XLwb.Sheets.Count 1 && XLwb.ActiveSheet !=
XLwb.Sheets.get_Item(1))
{
ErrorCounter++;
ProcessError(ErrorCounter, "The first sheet is not the selected
sheet");
}




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
Sheet selected, automatic return to top of sheet MIKEY Excel Worksheet Functions 7 March 9th 10 10:58 AM
copying only selected data from Sheet 1 to Sheet 2 Jaf Excel Worksheet Functions 2 September 1st 09 01:01 AM
Check Activesheet for chart sheet or work sheet NSK Charts and Charting in Excel 1 July 17th 07 09:00 PM
how to use sumif function to check date in 1 sheet is < 2 sheet Bharat Saboo Excel Worksheet Functions 3 December 30th 05 07:10 AM
Updating excel sheet with selected data from another sheet in the same file gsnivas Excel Worksheet Functions 1 August 4th 05 09:55 AM


All times are GMT +1. The time now is 01:42 PM.

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

About Us

"It's about Microsoft Excel"