Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Can I test for a range of 4 cells in the same column to be numbers?
If any of the cells within Range("S16:S19) are NOT Numbers then MsgBos Else |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
dim myRng as range
with activesheet set myrng = .range("s16:S19") end with if application.count(myrng) = myrng.cells.count then 'all numbers else 'not all numbers end if CRayF wrote: Can I test for a range of 4 cells in the same column to be numbers? If any of the cells within Range("S16:S19) are NOT Numbers then MsgBos Else -- Dave Peterson |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Way new at this and Im not sure how to add this within my loop...
My current code this. It loops but for this eample lets assume j=11... I am currently using the Application.CountA.Range testing Range.Count but this seems not to work, if I change it to test looing for numbers I know that will... So, How could I augment this stamtment using your sugestion for testing for numners? If Target.Address = "$S$4" And ActiveSheet.Name < _ srcBettingTemplateWs.Name Then srcBettingTemplateWs.Unprotect If Application.CountA(Range("S" & j + 5 & ":S" & j + 8)) < _ Range("S" & j + 5 & ":S" & j + 8).Count Then 'At least one of your racers are missing. 'code here Else 'No racers are missing. End If End If "Dave Peterson" wrote: dim myRng as range with activesheet set myrng = .range("s16:S19") end with if application.count(myrng) = myrng.cells.count then 'all numbers else 'not all numbers end if |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Change application.countA to application.count
Excel's help (Not VBA's) will explain the difference between the two. Personally, I like myrng.cells.count instead of myrng.count--just because I think the first is more "self-documenting". But both will count the number of cells in that range. CRayF wrote: Way new at this and Im not sure how to add this within my loop... My current code this. It loops but for this eample lets assume j=11... I am currently using the Application.CountA.Range testing Range.Count but this seems not to work, if I change it to test looing for numbers I know that will... So, How could I augment this stamtment using your sugestion for testing for numners? If Target.Address = "$S$4" And ActiveSheet.Name < _ srcBettingTemplateWs.Name Then srcBettingTemplateWs.Unprotect If Application.CountA(Range("S" & j + 5 & ":S" & j + 8)) < _ Range("S" & j + 5 & ":S" & j + 8).Count Then 'At least one of your racers are missing. 'code here Else 'No racers are missing. End If End If "Dave Peterson" wrote: dim myRng as range with activesheet set myrng = .range("s16:S19") end with if application.count(myrng) = myrng.cells.count then 'all numbers else 'not all numbers end if -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How can I test a range of cells for the presence of a border? | Excel Worksheet Functions | |||
Array as a "named range" - formula ok in cells, but error as "named range" | Excel Discussion (Misc queries) | |||
test a range of cells and return an adjacent value | Excel Worksheet Functions | |||
Test for data in a range of cells | Excel Worksheet Functions | |||
Using "Cells" to write "Range("A:A,H:H").Select" | Excel Programming |