+ Reply to Thread
Results 1 to 4 of 4

Not getting the value in cells of a range passed to a function

  1. #1
    Registered User
    Join Date
    05-07-2017
    Location
    Harbor City, United States
    MS-Off Ver
    office 2016
    Posts
    1

    Not getting the value in cells of a range passed to a function

    Hi here is the code for a simple add with criteria that I am trying to debug in excel
    Please Login or Register  to view this content.
    the spreadsheet has columns a and b with data from row 2 through 26
    when i reach row 5 in the sqft column (b) there is a 5 so I add the amount to
    the function name and go to the next row. There is a 5 that I entered in rows 13 and
    row 24 but the function doesn't see those values. It sees only old data that I entered in the cells or
    what is in the sales column (I'm not really sure what it is looking at) I query the sqft.cells(row, column) and it doesn't see
    the 2 fives that I entered. I can't really figure out what is wrong. I have saved the code in the module and saved and closed and
    reopened the spreadsheet but it still doesn't work.
    Last edited by JohnORourke1351; 08-13-2018 at 02:35 AM.

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Not getting the value in cells of a range passed to a function

    Try this. When you use the syntax sqft.cells(row,column), The row and column are not absolute references. They are relative to the sqft range.

    Please Login or Register  to view this content.

    Or just this...

    Please Login or Register  to view this content.
    Last edited by AlphaFrog; 08-13-2018 at 05:32 AM.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Valued Forum Contributor
    Join Date
    07-14-2017
    Location
    Poland
    MS-Off Ver
    Office 2010
    Posts
    528

    Re: Not getting the value in cells of a range passed to a function

    When there is a value of 5 in Col. B, to add the value Col. A, the UDF has the form
    Please Login or Register  to view this content.
    Regards

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: Not getting the value in cells of a range passed to a function


    Hi !

    Better than a loop is to use an Excel function like SUMIF for example even in a VBA procedure …

+ 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. Macro function has been passed to me. not sure its exact function
    By SeanBaird in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-12-2015, 03:04 PM
  2. Wildcards passed to custom function
    By drmartell in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-05-2013, 06:27 PM
  3. [SOLVED] Arrays passed into function
    By ChrisHag in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-04-2013, 09:46 AM
  4. [SOLVED] Modify range variable passed through Function
    By spyd3r in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-14-2006, 07:25 PM
  5. [SOLVED] Lookup up active cell value in passed range
    By ExcelMonkey in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-19-2005, 08:05 AM
  6. [SOLVED] Excel2000: Reading values from range, passed to function as parameter using an expression
    By Arvi Laanemets in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-29-2005, 10:06 AM
  7. [SOLVED] ClearContents method on a passed range
    By bryan in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 01-19-2005, 05:06 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