+ Reply to Thread
Results 1 to 5 of 5

If ActiveSheet <> Sheets(1) Then - Problem

Hybrid View

  1. #1
    Registered User
    Join Date
    03-20-2015
    Location
    birm
    MS-Off Ver
    2013
    Posts
    41

    If ActiveSheet <> Sheets(1) Then - Problem

    Hi

    I want to ensure a particular part of the macro does not run on the first sheet in the workbook.

    Trying to use:

    If ActiveSheet <> Sheets(1) Then
    The sheets will have different names each time therefore I've tried unsuccessfully to use Sheets(1)

    I'm getting the following error:

    Object doesn't support this property or method.

    Any help would be appreciated.

    Thanks

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,788

    Re: If ActiveSheet <> Sheets(1) Then - Problem

    You just missing the Name property

    If ActiveSheet.Name <> Sheets(1).Name Then


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Registered User
    Join Date
    03-20-2015
    Location
    birm
    MS-Off Ver
    2013
    Posts
    41

    Re: If ActiveSheet <> Sheets(1) Then - Problem

    Thanks mate worked like a charm

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: If ActiveSheet <> Sheets(1) Then - Problem

    Try this.
    If ActiveSheet.Name <> Sheets(1).Name Then
    Or you could loop through the sheets like this, which will skip the first sheet.
    For I = 2 To Sheets.Count
        Set ws = Sheets(I)
    Next I
    If posting code please use code tags, see here.

  5. #5
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,879

    Re: If ActiveSheet <> Sheets(1) Then - Problem

    Try -

    If ActiveSheet.Name <> Sheets(1).Name Then
        'Whatever You Want
    End If
    Cheers!
    Deep Dave

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Using the GetOpenFileName method to import sheets after activesheet
    By amphinomos in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-27-2014, 07:48 AM
  2. ActiveSheet.PivotTables => How to do it for custom sheet? (replace ActiveSheet)
    By chrisignm in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-03-2014, 03:22 PM
  3. [SOLVED] Macro to run on all sheets except Activesheet
    By swagatam2014 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-10-2013, 03:50 PM
  4. Is it possible to replace 'ActiveSheet' by 'Sheets(strImported)' ??????????
    By Hutas in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-23-2005, 01:41 PM
  5. ActiveSheet.ShowDataForm Problem...
    By wwfc_barmy_army in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-04-2005, 11:52 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1