+ Reply to Thread
Results 1 to 13 of 13

Hide/Unhide text box based on cell value with real-time data from arduino

  1. #1
    Registered User
    Join Date
    12-02-2016
    Location
    Philippines
    MS-Off Ver
    2013
    Posts
    21

    Post Hide/Unhide text box based on cell value with real-time data from arduino

    Hi! I need some help. I have a column in sheet 1 that have a real time data on it that comes from arduino and I want to hide or unhide a textbox on sheet2 based on the value of the cells in the column but everytime the arduino feed data to the cell nothing happens but when I manually enter data the textbox can now be hide/unhide. Please help! Here is my code:


    Please Login or Register  to view this content.
    Last edited by art_a_game; 12-12-2016 at 12:11 AM.

  2. #2
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Hide/Unhide text box based on cell value with real-time data from arduino

    You are comparing the Target's value with "40" (40 as string datatype), which means :
    6 <= "40" --> True
    "6" <= "40" --> False

    So if your arduino set data on column B as string, you probably want to change the event sub to something like this :
    Please Login or Register  to view this content.
    1. I care dog
    2. I am a loop maniac
    3. Forum rules link : Click here
    3.33. Don't forget to mark the thread as solved, this is important

  3. #3
    Registered User
    Join Date
    12-02-2016
    Location
    Philippines
    MS-Off Ver
    2013
    Posts
    21

    Re: Hide/Unhide text box based on cell value with real-time data from arduino

    Hi! Thanks for the reply! My arduino data is set as float but i'll try this out! By the way my arduino data appears in column b of sheet 1 but my textbox is in sheet 2.
    Last edited by art_a_game; 12-12-2016 at 01:35 AM.

  4. #4
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Hide/Unhide text box based on cell value with real-time data from arduino

    You are welcome.

    If the changes is on sheet1, then the event sub must be placed on sheet1 also, or it will not be triggered, so put this code on sheet1 (not sheet2) :
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    12-02-2016
    Location
    Philippines
    MS-Off Ver
    2013
    Posts
    21

    Re: Hide/Unhide text box based on cell value with real-time data from arduino

    It works! Super Thank You!!!!

  6. #6
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Hide/Unhide text box based on cell value with real-time data from arduino

    You are welcome.

    Don't forget to mark this thread as solved :
    select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

  7. #7
    Registered User
    Join Date
    12-02-2016
    Location
    Philippines
    MS-Off Ver
    2013
    Posts
    21

    Re: Hide/Unhide text box based on cell value with real-time data from arduino

    I tried entering the values manually and it works but when I tried the arduino data the textbox is not hiding. What I observe is that everytime I press enter, the code applies but when i doesn't hit enter the code doesn't applies.

  8. #8
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Hide/Unhide text box based on cell value with real-time data from arduino

    It means that arduino sending the data without carriage return ending. You must modify your arduino side (not Excel side) code.
    From a quick googling, you may want to use println() instead of print() or write(), or if you use print() or write() you must manually adding the carriage return :
    https://www.arduino.cc/en/Serial/Println
    http://forum.arduino.cc/index.php?topic=144434.0

  9. #9
    Registered User
    Join Date
    12-02-2016
    Location
    Philippines
    MS-Off Ver
    2013
    Posts
    21

    Re: Hide/Unhide text box based on cell value with real-time data from arduino

    I have my println but still isn't working

  10. #10
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Hide/Unhide text box based on cell value with real-time data from arduino

    Then you must ask this (not sending carriage return) on arduino forum. From Excel (vba) side, the code is already good. The last missing point is howto adding/sending carriage return to the data that you send.

  11. #11
    Registered User
    Join Date
    12-02-2016
    Location
    Philippines
    MS-Off Ver
    2013
    Posts
    21

    Re: Hide/Unhide text box based on cell value with real-time data from arduino

    My data is already in carriage return. I also tried put a lookup formula in cell "E2" for column B and change the code to:

    Please Login or Register  to view this content.
    Still it isn't working i am thinking that it is really with the enter factor.
    Last edited by art_a_game; 12-12-2016 at 05:11 AM.

  12. #12
    Registered User
    Join Date
    12-02-2016
    Location
    Philippines
    MS-Off Ver
    2013
    Posts
    21

    Re: Hide/Unhide text box based on cell value with real-time data from arduino

    By the way karedog thank you again for helping me.

  13. #13
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Hide/Unhide text box based on cell value with real-time data from arduino

    You are welcome. I can't help you further because I don't have any arduino hardware. You can also try to add linefeed after carriage return (chr(13) chr(10)) as mentioned in one of the links on post #8. You better to ask this on one of arduino forum, since the problem is related to arduino side. Once you success simulating "pressing enter", the vba code is already good to run. As a note, your current arduino code is only sending "some characters" to Excel without "pressing Enter", this will make Excel is still in "Edit mode" (like when you pressing F2 on a cell and typing but hasn't press Enter or click on other cell yet), and this will not trigger the event sub.

+ 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. How to Run a Macro Based on Change in a cell caused by incoming Real-Time Server Data
    By taxkinginc in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-18-2016, 05:00 AM
  2. How to Hide-Unhide Row Based on a Cell Value
    By putritersenyum in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-18-2015, 06:56 AM
  3. [SOLVED] Hide and unhide text box based on a cell value - 2
    By Rocky2013 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-27-2015, 06:59 PM
  4. [SOLVED] Unhide and Hide row(s) based on value in a cell in the row above
    By jammi1710 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-18-2014, 01:27 AM
  5. [SOLVED] Hide/Unhide sheets based on text result of IF Formula in cell in another sheet
    By yukinosei in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-16-2014, 01:17 PM
  6. [SOLVED] hide or unhide rows based on text within a drop down list
    By souimet in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-17-2013, 01:32 AM
  7. Hide/Unhide rows based on system time?
    By Johnnyellow23 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-17-2013, 03: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