Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 115
Default Test cells within Range("S16:S19) are NOT Numbers

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Test cells within Range("S16:S19) are NOT Numbers

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 115
Default Test cells within Range("S16:S19) are NOT Numbers

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Test cells within Range("S16:S19) are NOT Numbers

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I test a range of cells for the presence of a border? PFB Excel Worksheet Functions 7 November 10th 08 05:19 AM
Array as a "named range" - formula ok in cells, but error as "named range" tskogstrom Excel Discussion (Misc queries) 11 December 28th 06 04:44 PM
test a range of cells and return an adjacent value whub3 Excel Worksheet Functions 5 April 20th 06 01:04 AM
Test for data in a range of cells Spike9458 Excel Worksheet Functions 4 January 20th 06 09:06 PM
Using "Cells" to write "Range("A:A,H:H").Select" Trip Ives[_2_] Excel Programming 3 June 5th 04 03:13 PM


All times are GMT +1. The time now is 03:20 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"