+ Reply to Thread
Results 1 to 2 of 2

VBA code for a Sumif formula that uses variables

  1. #1
    Registered User
    Join Date
    09-05-2019
    Location
    Lima, Peru
    MS-Off Ver
    2013
    Posts
    1

    VBA code for a Sumif formula that uses variables

    I download a data set that always has a different number of rows. I store two columns as variables, the imports and the months. Then I need to run a Sumif formula that sums the value of imports by the months. I am writing a Sumif formula that uses the two variables and references the cell to its left.

    The cells however vary in location based on the changing size of the data set. So I write a code to select the last active cell on a column and select the cell 3 rows down.

    When writing the formula with the variables and the cell its giving me an error. Please help first sorry for any typos fist time doing this.

    I select all the active cells in range D and store them as months, I do the same for the imports. Then using range I find the last active cell on column M, and use select the cell 3 rows down, where I wish to write my formula.

    Please see my codes to see what am I doing wrong, I am a novice coder.


    Please Login or Register  to view this content.

  2. #2
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,903

    Re: VBA code for a Sumif formula that uses variables

    https://stackoverflow.com/questions/...sumif-function
    Rory

+ 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. Need help with multiple variables formula/VBA code with dropdown box
    By deancorleone in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-24-2013, 10:41 PM
  2. sumif formula for multiple variables
    By motobeyek in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-31-2010, 11:01 PM
  3. A VBA Code for sumif formula?
    By AnthonyWB in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-20-2010, 10:19 AM
  4. Write SUMIF formula to cell with variables
    By jaslake in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-07-2010, 07:45 PM
  5. Unzip Code - Works without Variables, Breaks with Variables...
    By AdamParker in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-06-2009, 02:35 PM
  6. How do I set up a nested SUMIF formula for a number of variables?
    By Nancy in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-05-2006, 02:10 PM
  7. Usage of SUMIF formula in the VBA code
    By GreenInIowa in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-02-2005, 06:20 PM
  8. Usage of SUMIF formula in the VBA code
    By GreenInIowa in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-02-2005, 06:17 PM

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