+ Reply to Thread
Results 1 to 3 of 3

VBA code for Hiding formula from Formula Bar.

  1. #1
    Registered User
    Join Date
    02-19-2017
    Location
    Helsinki, Finland
    MS-Off Ver
    MS Office 365
    Posts
    60

    VBA code for Hiding formula from Formula Bar.

    Hello,
    Help me. I wrote this code for hiding formula from Formula Bar. But formula is not hiding. What is wrong? Could anybody help me??
    Dim myDic As New Dictionary

    Private Sub Worksheet_HideFormula(ByVal Target As Range)
    ' Before using this code do must: Tools - References - click on
    ' "Microsoft Scripting Runtime".
    Dim myCell As Range
    Dim myRng As Range
    Set myRng = Range("A2:J25")

    If myDic.Count <> myRng.Count Then
    For Each myCell In myRng
    myDic.Add myCell.Address, myCell.FormulaR1C1
    Next
    End If

    If (Target.Count = 1) And (Not Application.Intersect(myRng, Target) Is Nothing) And (Target.HasFormula) Then
    With Target
    .Value = .Value
    End With
    End If
    'MsgBox myDic.Count
    myDic.RemoveAll

    End Sub

  2. #2
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: VBA code for Hiding formula from Formula Bar.

    .
    https://stackoverflow.com/questions/...in-formula-bar

    https://www.extendoffice.com/documen...ing-sheet.html

    Both untested here.

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,445

    Re: VBA code for Hiding formula from Formula Bar.

    There isn't an Event Handler for "HideFormula".


    Administrative Note:
    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (Note: this change is not optional.)
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


+ 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. formula or process for hiding the formula used in spreadsheet
    By ARNABECO in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-19-2018, 12:17 PM
  2. [SOLVED] Difference Formula or Hiding the - sign with a subtract formula.
    By JonWilf in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-19-2016, 01:37 PM
  3. [SOLVED] Hiding and un hiding columns using VBA code
    By Jes1397 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-20-2015, 12:52 AM
  4. VBA Formula for hiding/unhiding rows- Formula tweak
    By varmoh in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-19-2015, 10:39 AM
  5. [SOLVED] How to avoid formula circular references and hiding and locking the formula
    By Venkata Krishna in forum Excel Formulas & Functions
    Replies: 23
    Last Post: 06-21-2013, 08:17 AM
  6. Using IF formula for multiple crieteria and hiding #N/A in Formula cell
    By sanjeevkumarmc in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-12-2012, 01:01 AM
  7. Hiding a formula
    By stait in forum Excel General
    Replies: 2
    Last Post: 08-31-2010, 09:31 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