+ Reply to Thread
Results 1 to 4 of 4

Application.Sumif funciton activates the other sheet tab

Hybrid View

  1. #1
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,784

    Application.Sumif funciton activates the other sheet tab

    Hello

    I am using this function in vba.

     With Sheets("Journal")
    .Range("C6").Value = Application.SumIf(.Range("E9:E1048576"), .Range("A2"), _
    .Range("G9:G1048576")) - Application.SumIf(.Range("E9:E1048576"), .Range("A2"), _
    .Range("H9:H1048576")) + Application.VLookup(.Range("A2"), Sheets("Chart_of_Accounts").Range("P3:T839"), 5, 0)
    End With
    Problem is that when I execute this code an irrelevent sheet is activated and I have to switch back to the Journal sheet.

    I am unable to configure it.
    Teach me Excel VBA

  2. #2
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Application.Sumif funciton activates the other sheet tab

    Hi,

    That code should not activate any sheet. If you need to make the Journal sheet active, simply add
    .Activate
    before the End With line.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  3. #3
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,784

    Re: Application.Sumif funciton activates the other sheet tab

    thanks a lot D

    I would like to know Why I am unable to give reputation to an expert twice if he helped me for two times consecutively?
    I am not giving for the same post but to same person for a different post. Will this not show my thanklessness?

  4. #4
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Application.Sumif funciton activates the other sheet tab

    I do not know why the system works that way but be assured that it certainly does not make you appear ungrateful to me!

+ 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] VBA assistance with Application.WorksheetFunction.SumIf
    By sintek in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-16-2016, 01:58 PM
  2. How to create a macro that 'activates' a filter on another sheet.
    By liamfrancis2013 in forum Excel General
    Replies: 6
    Last Post: 05-11-2016, 10:55 AM
  3. [SOLVED] Macro activates in wrong sheet
    By SoothSailor in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-08-2015, 12:17 PM
  4. Navivgation bar that activates selected sheet, then clears contents of the bar
    By jkindustries in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-24-2015, 08:53 AM
  5. Combine Subtotal & SumIf Funciton
    By mycon73 in forum Excel General
    Replies: 5
    Last Post: 11-08-2014, 11:21 AM
  6. Trying to Make My SUMIF formula calculate with the SUBTOTAL funciton
    By maliotta in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-21-2014, 05:32 PM
  7. Automatic updating of cells when sheet activates
    By popperm1 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-05-2013, 12:54 PM

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