Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I need a code that will search Sheet1.column A from A1:A58 and A72:A89 and
return in cell B1 the text "true" if the number "999" is found in the target range one or more times. -- Thanks Shawn |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Shawn,
Try this: Sub test() Dim x As Boolean With Application x = (.CountIf(Sheets("Sheet1").Range("A1:A58"), 999) _ + .CountIf(Sheets("Sheet1").Range("A72:A89"), 999)) 1 End With Sheets("Sheet1").Range("B1").Value = x End Sub Regards, KL "Shawn" wrote in message ... I need a code that will search Sheet1.column A from A1:A58 and A72:A89 and return in cell B1 the text "true" if the number "999" is found in the target range one or more times. -- Thanks Shawn |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I used the variation below and it worked. Your way did not. Do you see a
problem with what I have below (it seems to work) Sub test() Dim x As Boolean With Application x = .CountIf(Sheets("Sheet1").Range("A1:A58"), 999) _ + .CountIf(Sheets("Sheet1").Range("A72:A89"), 999) End With Sheets("Sheet1").Range("B1").Value = x End Sub -- Thanks Shawn "KL" wrote: Hi Shawn, Try this: Sub test() Dim x As Boolean With Application x = (.CountIf(Sheets("Sheet1").Range("A1:A58"), 999) _ + .CountIf(Sheets("Sheet1").Range("A72:A89"), 999)) 1 End With Sheets("Sheet1").Range("B1").Value = x End Sub Regards, KL "Shawn" wrote in message ... I need a code that will search Sheet1.column A from A1:A58 and A72:A89 and return in cell B1 the text "true" if the number "999" is found in the target range one or more times. -- Thanks Shawn |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
That should work.
-- Regards, Tom Ogilvy "Shawn" wrote in message ... I used the variation below and it worked. Your way did not. Do you see a problem with what I have below (it seems to work) Sub test() Dim x As Boolean With Application x = .CountIf(Sheets("Sheet1").Range("A1:A58"), 999) _ + .CountIf(Sheets("Sheet1").Range("A72:A89"), 999) End With Sheets("Sheet1").Range("B1").Value = x End Sub -- Thanks Shawn "KL" wrote: Hi Shawn, Try this: Sub test() Dim x As Boolean With Application x = (.CountIf(Sheets("Sheet1").Range("A1:A58"), 999) _ + .CountIf(Sheets("Sheet1").Range("A72:A89"), 999)) 1 End With Sheets("Sheet1").Range("B1").Value = x End Sub Regards, KL "Shawn" wrote in message ... I need a code that will search Sheet1.column A from A1:A58 and A72:A89 and return in cell B1 the text "true" if the number "999" is found in the target range one or more times. -- Thanks Shawn |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Shawn,
You are right I mistakenly assumed you wanted TRUE if 999 appeared more than once. Regards, KL "Shawn" wrote in message ... I used the variation below and it worked. Your way did not. Do you see a problem with what I have below (it seems to work) Sub test() Dim x As Boolean With Application x = .CountIf(Sheets("Sheet1").Range("A1:A58"), 999) _ + .CountIf(Sheets("Sheet1").Range("A72:A89"), 999) End With Sheets("Sheet1").Range("B1").Value = x End Sub -- Thanks Shawn "KL" wrote: Hi Shawn, Try this: Sub test() Dim x As Boolean With Application x = (.CountIf(Sheets("Sheet1").Range("A1:A58"), 999) _ + .CountIf(Sheets("Sheet1").Range("A72:A89"), 999)) 1 End With Sheets("Sheet1").Range("B1").Value = x End Sub Regards, KL "Shawn" wrote in message ... I need a code that will search Sheet1.column A from A1:A58 and A72:A89 and return in cell B1 the text "true" if the number "999" is found in the target range one or more times. -- Thanks Shawn |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Find First Non blank cell than find column header and return that value | Excel Worksheet Functions | |||
Despite data existing in Excel 2002 spreadsheet Find doesn't find | Excel Discussion (Misc queries) | |||
find and delete duplicate entries in two columns or find and prin. | Excel Programming | |||
find and delete text, find a 10-digit number and put it in a textbox | Excel Programming | |||
backwards find function to find character in a string of text | Excel Programming |