Showing posts with label result. Show all posts
Showing posts with label result. Show all posts

Friday, March 4, 2016

How to highlight an option button in EXCEL when it is selected by the user (no macro needed)

If you want to highlight the selected option button for your custom form in EXCEL, first set the background of the option button as "Transparent": Right click on the option button > "Format Control..." then on tab "Colors and Lines, put the "Transparency" level at 100% and press "OK":


Then if the result of your option button appear in cell "A5" for example (see previous post here to see how to do) then in cell A1 and A2 (behind the option buttons), enter respectivelly the following formulas:

"=if(A5=1,"color","")"
"=if(A5=2,"color","")"



Finally, create a conditional format to color the cell when the value of the cell is equal to "color". 
Trick to not show the formula: put the default font color of A1 and A2 as white and in the conditional formating options, set the font color to be same as the cell background color when the value is equal to "color".




As a result, the option button will be highlighted once the user select it:


Created by DoMyExcel.com © | Excel & VBA Consulting | Customized Excel Solutions starting at 29 USD
Services provided to Individuals and Businesses | Free Quote: DoMyExcel@gmail.com

Saturday, October 3, 2015

How to find a value in an Excel range and return its address in VBA

If you want to find the word "DoMyExcel" in a range of your spreadsheet and return its location / address, create a module with this code:

Sub Return_Search_Result_Adress()
    Dim My_Range As Range
    Set My_Range = Sheets("Sheet1").Range("A1:A10000").Find("DoMyExcel", lookat:=xlPart)
    If Not My_Range Is Nothing Then
           MsgBox "Found at " & My_Range.Address
    End If
End Sub

  • xlPart = looks at the text in the cell for any match. If you search for any part of the text (such as "Excel"), it will return "Found at $A$6".
  • xlWhole = looks at the entire/exact entry in the cell to see if it matches.
Created by DoMyExcel.com © | Excel & VBA Consulting | Customized Excel Solutions starting at 29 USD
Services provided to Individuals and Businesses | Free Quote: DoMyExcel@gmail.com