Home |
Search |
Today's Posts |
#18
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank you for the solution and the prompt reply. It works.
"Bernie Deitrick" wrote: Change this Else .Find("Gap").Select End If Else IF .Find("Gap") Is Nothing Then Exit Sub .Find("Gap").Select End If -- HTH, Bernie MS Excel MVP "Freddy" wrote in message ... Bernie, I am returning to continue this thread because I need to know what adjustment needs to be made to the code (the one shown below) so that it does not Debug if it does not find the string "Gap". "Bernie Deitrick" wrote: What kind of variables are they? Strings with cell addresses? Range objects? Code snippets would help. HTH, Bernie MS Excel MVP "Freddy" wrote in message ... I've been using the variables: "searchpoint1" and "searchpoint2" to determine the range throughout my testing. However, based on your latest sample code, I do not see where they would come into play. Please advise. "Bernie Deitrick" wrote: Set StartCell = Range("A2") Set EndCell = Range("A10") With Range(StartCell, EndCell) If .Cells(1).Value = "Gap" Then .Cells(1).Select Else .Find("Gap").Select End If .FormatConditions.Delete .FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, _ Formula1:="=""gap""" .FormatConditions(1).Interior.ColorIndex = 3 End With HTH, Bernie MS Excel MVP "Freddy" wrote in message ... Your latest solution works great. I'd like to move one step further and make the cells evaluated as "Gap" to be easily distinguishable (e.g. filled "Red"). Additionally, I'd like to set the focus to the location of the the first cell that reads "Gap". "Bob Phillips" wrote: Range("G1").Value = Application.WorksheetFunction.CountIf(Range(StartC ell, EndCell), "Gap") -- __________________________________ HTH Bob "Freddy" wrote in message ... I've decided to use your suggestion of using the myGap variable. It works well. Now, I'd like to place the result automatically into cell G1. How do I do that? Should I use ActiveCell.FormulaR1C1 or a variant there of? "Bernie Deitrick" wrote: Lots of ways: MsgBox Application.WorksheetFunction.CountIf(Range("A:A") , "Gap") & " cells contain ""Gap""" Or Set StartCell = Range("A2") 'or other way of identifying cell Set EndCell = Range("A10") myGap = Application.WorksheetFunction.CountIf(Range(StartC ell, EndCell), "Gap") MsgBox myGap & " cells contain ""Gap""" HTH, Bernie MS Excel MVP "Freddy" wrote in message ... I would like to know if it is possible to insert a countif formula in a cell using variables that have been determined by identifying a start cell and an end cell in a record set. My goal is to determine, using countif(range,criteria), how many cells in a range read "Gap". |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
COUNTIF with or + and variables | Excel Worksheet Functions | |||
COUNTIF Function with variables | Excel Worksheet Functions | |||
COUNTIF with 2 variables. HOW??? | Excel Worksheet Functions | |||
Countif function with variables | Excel Worksheet Functions | |||
COUNTIF ON 2 VARIABLES ?? | Excel Worksheet Functions |