+ Reply to Thread
Results 1 to 7 of 7

Link a Formulated Cell to a Label Caption in a Userform in Real Time

  1. #1
    Forum Contributor
    Join Date
    08-04-2018
    Location
    San Dieg CA
    MS-Off Ver
    Microsoft Office Professional Plus 2016 (Excel 2016 MSO 32 bit)
    Posts
    167

    Link a Formulated Cell to a Label Caption in a Userform in Real Time

    Ladies and Gentlemen,
    Respectfully request some assistance please. I would like to display a cell value (“F15”) into a label caption (label20) in real time, in other words not just when the userform is launched.
    I can’t use UserForm_Initialize() because I’m already using it for another code in the userform. I’ve tried and got an “Ambiguous Name Detected” error. I’ve also tried to this from the worksheet as Worksheet_SelectionChange(ByVal Target As Range) but neither method works. I’ve tried several code found online including some found in here and none work. I’m losing hope, can some please out with this. The code I’m using is below. Also, I need to mention that the cell (“F15”) is populate through a formula. Thank you as always.
    Please Login or Register  to view this content.
    Last edited by RoroBear; 08-05-2019 at 10:19 PM. Reason: Slight Error in Code

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,430

    Re: Link a Formulated Cell to a Label Caption in a Userform in Real Time

    I see no reason why you can not include that code in the initialize event. Do not create a copy of the event or you will get the Ambiguous name detected. Simply add the code within the existing routine.

    If the userform changes cells which causes the linked cell to update then you will need to refresh the label. This can be done by adding your code to the end of the routine that changes cells.
    If the userform is modeless and the user can change cells which affect the linked cell then you will need to create an object that allows you to detect cell changes.

    If you need more help post an example workbook and explain how it should be used in order to make the cell change.

    Welcome to the forum

    Please attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Forum Contributor
    Join Date
    08-04-2018
    Location
    San Dieg CA
    MS-Off Ver
    Microsoft Office Professional Plus 2016 (Excel 2016 MSO 32 bit)
    Posts
    167

    Re: Link a Formulated Cell to a Label Caption in a Userform in Real Time

    I'm sorry Andy, I don't understand all of which you wrote. I'm not very good with VBA, I'm still learning. in any case, there use to be a textbox where label 20 is which was linked to a cell and worked appropriately. however, It only updated when I close and reopened the userform. I don't like that. I want it to update while I'm in the form. if you open the form (see attached) click on any of the 1-16 or 16-EOM buttons, it brings up a inputbox which is what populates various cells in the worksheet, one of which ("F15") I want to update in real time in the label caption. I hope my explanation makes sense. any assistance is greatly appreciated.

    RB
    Attached Files Attached Files

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,430

    Re: Link a Formulated Cell to a Label Caption in a Userform in Real Time

    This will update label when userform is shown
    Please Login or Register  to view this content.
    And adding the same thing to the end of the calculation routine will refresh the label
    Please Login or Register  to view this content.
    Last edited by Andy Pope; 08-07-2019 at 03:07 AM. Reason: fix code tag

  5. #5
    Forum Contributor
    Join Date
    08-04-2018
    Location
    San Dieg CA
    MS-Off Ver
    Microsoft Office Professional Plus 2016 (Excel 2016 MSO 32 bit)
    Posts
    167

    Re: Link a Formulated Cell to a Label Caption in a Userform in Real Time

    Andy,

    it doesn't work. as I mention previously I already have a "Private Sub UserForm_Initialize" code in the form, and when I add another I get the “Ambiguous Name Detected” error.

    v/

  6. #6
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,302

    Re: Link a Formulated Cell to a Label Caption in a Userform in Real Time

    Could not see "Private Sub UserForm_Initialize" in form so I added it as Andy suggests.
    Plus extra line as Andy's suggestion.
    It works for me !!!!!!!!!!!
    torachan.
    Attached Files Attached Files

  7. #7
    Forum Contributor
    Join Date
    08-04-2018
    Location
    San Dieg CA
    MS-Off Ver
    Microsoft Office Professional Plus 2016 (Excel 2016 MSO 32 bit)
    Posts
    167

    Re: Link a Formulated Cell to a Label Caption in a Userform in Real Time

    you are absolutely correct, it wasn't in there. I removed from the form I uploaded because it has personal information. however, i'm happy to say I was able to get it work, by simply changing Initialize to Activate. I appreciate you coming my aid. thank you, sir!!!

+ 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] Label Caption = cell value In UserForm
    By HaroonSid in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-18-2014, 08:37 AM
  2. Using Picture and Caption in a Label on Userform at same time
    By bdb1974 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-01-2014, 09:15 AM
  3. [SOLVED] Userform Label Caption - How To Set It To Display Military Time?
    By ScotyB in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-15-2013, 06:27 PM
  4. Real time update of Userform label with cell value
    By KyleLee in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-25-2009, 09:58 AM
  5. Show real time in Userform caption
    By Henrich in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-13-2006, 11:30 AM
  6. Link Cell to Label Caption
    By papaitaliano in forum Excel General
    Replies: 1
    Last Post: 03-21-2006, 01:25 PM
  7. Link cell to Label Caption
    By papaitaliano in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-21-2006, 01:00 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