Adding a format condition in Excel through Access VBA


So currently i got these lines in my code,

.Range("C2").Formula = "=IF(B2 = """"," & """REQUIRED""" & "," & """""" & ") " .Range("C3").Formula = "=IF(B3 = """"," & """REQUIRED""" & "," & """""" & ") "

my goal was to add a conditional formatting to it, so if it equal to Required from the range =$C$2:$C$3 turn background red so far ive seen some codes online but none of them seem to apply. I modified some existing code for my purposes by i get an error on xlExpression "variable not defined". Can anyone help me?

.Range("C2:C3").Selection.FormatConditions.Delete .Range("C2:C3").Selection.FormatConditions.Add TYPE:=xlExpression, Formula1:="=(=$C$2:$C$23 = 'REQUIRED')"


You have to replace xlExpression with 2.


  • ionic 4 adding side menu
  • Reactjs - passing state value from one component to another
  • Why is `unit` treated differently by the F# type system when used as a generic interface argument?
  • How do I use the private key from a PFX certificate stored in Azure Key Vault in .NET Core 2?
  • Angular 4 Animation won't trigger on route change
  • PowerShell + AD: Return users from within any groups in a specific OU, plus count
  • How to make a Label appear then disappear after a certain amount of time in python tkinter
  • Java Generics - When to use “T” and “?” [closed]
  • Unity3D display Google Admob slow
  • Botframework Dialog migration v3 to v4
  • How to align elements in cells of a css grid?
  • Tooltip on Hover of select box options generated by ng-options in Angularjs
  • my javascript in external html is not loading
  • Write and Read from a file
  • How to extract details from the xml files using java?
  • Sending EoS to filesink while removing branch from tee
  • Where to store larger data for Outlook Web App?
  • MySQL - Filter records which date is biggest
  • Hibernate Idempotent Update
  • create circular Auto Horizontal Scroll View?
  • Threads and Concurrent Modification Exception working with a list
  • Was there ever a proposal to include the URL fragment into the HTTP request?
  • can you use embedded ruby in custom javascript files in rails?
  • Getting/building the SQL (with parameters) from NHibernate 3.2
  • $this->a->b->c->d calling methods from a superclass in php
  • Validating my form with Jquery
  • How to select multiple items from a List view - JavaFX 8
  • What are advantages/disadvantages of using Selenium for Java vs .NET applications?
  • Delphi Prism getting Unknown Identifier “DllImport” error
  • Swift: UIView.animate works unexpectedly
  • DataTables move rows between tables
  • How to integrate angular2-material (alpha 8.2) with angular2-Quickstart app
  • Why isn't stemDocument stemming?
  • Send array to next viewcontroller iOs xcode [duplicate]
  • Comma decimal separator is ignored by ASP.NET MVC model binder
  • Make checkout phone field optional for specific countries in WooCommerce
  • Why does Rails 3 think xE2x80x89 means â x80 x89
  • Firebase: How to read from external DB?
  • Running R's aov() mixed effects model from Python using rpy2