Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default How To Validating Range of Cells

Hi, without going cell-by-cell, is there any quick way to validate a range of
cells (e.g. A1:B10) to be numeric and returns the error cell address if not
numeric? Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 298
Default How To Validating Range of Cells

What's wrong with going cell-by-cell ?

Tim

"aushknotes" wrote in message
...
Hi, without going cell-by-cell, is there any quick way to validate a range
of
cells (e.g. A1:B10) to be numeric and returns the error cell address if
not
numeric? Thanks.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default How To Validating Range of Cells

As long as the code will not be used in anyway as part of a User Defined
Function, the you can use code constructed like this...

Dim R As Range, TextAddress As String
.....
.....
Set R = Range("A1:H14")
On Error Resume Next
TextAddress = R.SpecialCells(xlCellTypeConstants, xlTextValues).Address
If Len(TextAddress) = 0 Then
MsgBox "All cells in range are either numbers or blanks"
Else
MsgBox "Cell " & TextAddress & " is not a number"
End If

--
Rick (MVP - Excel)


"aushknotes" wrote in message
...
Hi, without going cell-by-cell, is there any quick way to validate a range
of
cells (e.g. A1:B10) to be numeric and returns the error cell address if
not
numeric? Thanks.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default How To Validating Range of Cells

Perfect & very neat! Thanks a million!



"Rick Rothstein" wrote:

As long as the code will not be used in anyway as part of a User Defined
Function, the you can use code constructed like this...

Dim R As Range, TextAddress As String
.....
.....
Set R = Range("A1:H14")
On Error Resume Next
TextAddress = R.SpecialCells(xlCellTypeConstants, xlTextValues).Address
If Len(TextAddress) = 0 Then
MsgBox "All cells in range are either numbers or blanks"
Else
MsgBox "Cell " & TextAddress & " is not a number"
End If

--
Rick (MVP - Excel)


"aushknotes" wrote in message
...
Hi, without going cell-by-cell, is there any quick way to validate a range
of
cells (e.g. A1:B10) to be numeric and returns the error cell address if
not
numeric? Thanks.


.

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
Validating cells [email protected] Excel Discussion (Misc queries) 1 October 30th 08 12:53 AM
Validating range names procreator Excel Programming 2 March 27th 07 01:05 PM
Validating Cells TheRook Excel Programming 2 August 24th 06 11:57 AM
Validating non-blank cells in workbook cboyko Excel Worksheet Functions 1 April 12th 06 07:55 PM
Validating cells Kevin Excel Discussion (Misc queries) 1 February 2nd 06 06:04 PM


All times are GMT +1. The time now is 06:26 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"