+ Reply to Thread
Results 1 to 4 of 4

VBA To Capture Values From Cells

  1. #1
    Forum Contributor
    Join Date
    06-18-2010
    Location
    USA
    MS-Off Ver
    Excel 2016
    Posts
    546

    VBA To Capture Values From Cells

    I am in need of a way to filter a worksheet then sum one column, and capture the first non 0 or null value for another. I have spent hours working on this and am unable to get the syntax exactly right. I have attached a sample workbook with sample data and set-up, and the VBA that I have tried.

    How should code be altered so that my desired value is returned?
    Attached Files Attached Files

  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: VBA To Capture Values From Cells

    Hi,

    You could do this
    Please Login or Register  to view this content.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  3. #3
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: VBA To Capture Values From Cells

    @xlnitwit:

    I was coming up with a similar solution, but just FYI, you don't have to do the IsNumeric check, you can just do a specialcells subset of a specialcells set. Given a large enough data set, the speed up would be noticeable.

    Please Login or Register  to view this content.
    I'm interested in starting a career working with VBA, if anyone knows of any opportunities!

  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: VBA To Capture Values From Cells

    @walruseggman,

    Great name!

    That is true, although
    1. You need to break that into two lines, because if the first specialcells method only returned one cell, the second would apply to the entire sheet.
    2. If I had a really large dataset I probably wouldn't use an autofilter at all.

    Actually, scrap point 1. It seems that doesn't apply if you chain specialcells commands. It would still need an error handler though.
    Last edited by xlnitwit; 03-23-2017 at 12:35 PM.

+ 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] Input a value and capture the next 5 values
    By danallamas in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-18-2016, 09:07 PM
  2. Macro to capture values from web
    By Rockafella in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-14-2012, 09:28 AM
  3. Capture values from active IE page
    By rkb in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-19-2011, 12:19 AM
  4. Replies: 17
    Last Post: 11-30-2009, 05:21 PM
  5. Ontime to capture cells values at a giving time
    By erickguz in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-22-2007, 01:33 AM
  6. capture unique values and calculate
    By bcamp1973 in forum Excel General
    Replies: 4
    Last Post: 05-15-2006, 01:06 PM
  7. [SOLVED] RE: 'IF' FORMULA TO CAPTURE CERTAIN CELL VALUES
    By JMB in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 03-26-2006, 06:55 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