+ Reply to Thread
Results 1 to 4 of 4

VBA to read cell contents, not formula

  1. #1
    Registered User
    Join Date
    05-16-2004
    Posts
    22

    VBA to read cell contents, not formula

    Hello,

    I am so close to having a working code. The problem is I need the VBA code to read the results of the value in the cell, not that there is a formula in the cell. Here is the code and I’ll explain a little better.

    Please Login or Register  to view this content.
    Ultimately, if there is an “H” returned by the formula in a cell A2:A40, (on the ‘Summary' sheet) then hide the row, if not, show the row, and when done checking A2:A40 update all the tables in the whole Workbook.

    This should happen automatically when a different sheet (‘Case Type’) in the workbook is updated that the formulas in this sheet are looking at.

    Here is the code on the ’Summary’ sheet in cells A2:A40:

    Please Login or Register  to view this content.
    Anyways- it all works fine when I manually type an “H” into one of the cells in between A2 and A40 on the ’Summary’ sheet, but when the formula returns an “H” it doesn’t work because the VBA only sees the formula, not the Value returned.

    Would someone please help either correct the code I have or suggest a new one that accomplishes the underlined mission above?

    All help is appreciated. Thank you!!

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: VBA to read cell contents, not formula

    can you attach a sample file for testing ?
    If solved remember to mark Thread as solved

  3. #3
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: VBA to read cell contents, not formula

    Hi, MAGICofSeth,

    using Worksheet_Change will only get fired if the cell is either altered, entered or filled by query. If the cell is filled with a formula you would need to use the Worksheet_Calculate-event or monitor the cells which preceed the formulas (in your case the cells in Sheet Case Type).

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: VBA to read cell contents, not formula

    Your post does not comply with Rule 8 of our Forum RULES. Do not crosspost your question on multiple forums without including links here to the other threads on other forums.

    Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.

    Expect cross-posted questions without a link to be closed and a message will be posted by the moderator explaining why. We are here to help so help us to help you!

    Read this to understand why we ask you to do this, and then please edit your first post to include links to any and all cross-posts in any other forums (not just this site).

+ 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. Replies: 0
    Last Post: 11-06-2012, 11:16 AM
  2. Replies: 4
    Last Post: 10-01-2012, 11:15 AM
  3. [SOLVED] How to not read a cell with a formula as a value
    By williamthomp in forum Excel General
    Replies: 6
    Last Post: 05-25-2012, 10:02 AM
  4. Replies: 2
    Last Post: 07-15-2006, 03:40 AM
  5. Open a file and read contents
    By Striker in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-27-2006, 03:20 AM

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