Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
doing COUNTIF() in code
I was using the countif function to see if there was one "X" in th
E4:E3310 range. (COUNTIF($E$4:$E$3310,"=X")) = 1 It works fine. Now I need to use the same results to process some code. But of course the IF statement in the following will not work: ---------------------------------------------------------------------- If ((COUNTIF($E$4:$E$3310,"=X"))= 1) Then Sheets("wsheet").Select Sheets("wsheet").Range("A5:j100").ClearContents ' additional stuff goes here Exit Sub End If MsgBox "Please select one." ---------------------------------------------------------------------- Can you help me fix the above code so that it works -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
doing COUNTIF() in code
Lothario,
Sub test() If WorksheetFunction.CountIf(Range("$E$4:$E$3310"), "X") = 1 Then MsgBox "Hello" End If End Sub Rob "lothario " wrote in message ... I was using the countif function to see if there was one "X" in the E4:E3310 range. (COUNTIF($E$4:$E$3310,"=X")) = 1 It works fine. Now I need to use the same results to process some code. But of course the IF statement in the following will not work: ---------------------------------------------------------------------- If ((COUNTIF($E$4:$E$3310,"=X"))= 1) Then Sheets("wsheet").Select Sheets("wsheet").Range("A5:j100").ClearContents ' additional stuff goes here Exit Sub End If MsgBox "Please select one." ---------------------------------------------------------------------- Can you help me fix the above code so that it works? --- Message posted from http://www.ExcelForum.com/ |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
doing COUNTIF() in code
|
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
split post code (zip code) out of cell that includes full address | Excel Discussion (Misc queries) | |||
What's the vba code equivalent for Countif | Excel Discussion (Misc queries) | |||
how to do a countif - want cells that are before or on a certain dateand do not want to hard code that date | Excel Worksheet Functions | |||
Drop Down/List w/Code and Definition, only code entered when selec | Excel Worksheet Functions | |||
COUNTIF TO BUILD SIMPLE CODE | Excel Worksheet Functions |