Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Eight celles on my worksheet need to be numeric only, and if a user
inputs text into any of the 8 cells then, the key commands (or other method) do not work. (or accepted) Here is what i have managed to piece together so far from the help files. Private Sub Worksheet_Change(ByVal Target As Range) dim cellok as boolean Dim vdata As Range, Cell As Range Set vdata = Range("b5,d5,f5,h5,j5,b9,d9,f9,h9,j9") If IsNumeric(vdata.Cell).Value Then cellOk Else End If End Sub --- Message posted from http://www.ExcelForum.com/ |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
IsNumeric will not evaluate a multicell range as you appear to be trying to
do. You need to check each cell individually. Why not just use Validation under the data menu? -- Regards, Tom Ogilvy mikewild2000 wrote in message ... Eight celles on my worksheet need to be numeric only, and if a user inputs text into any of the 8 cells then, the key commands (or other method) do not work. (or accepted) Here is what i have managed to piece together so far from the help files. Private Sub Worksheet_Change(ByVal Target As Range) dim cellok as boolean Dim vdata As Range, Cell As Range Set vdata = Range("b5,d5,f5,h5,j5,b9,d9,f9,h9,j9") If IsNumeric(vdata.Cell).Value Then cellOk Else End If End Sub --- Message posted from http://www.ExcelForum.com/ |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Tom, what about the Len function, as this does not work either.
Dim vdata As Range, Cell As Range Set vdata = Range("c7:j7") If Len(vdata.Cell).Value Then exit sub end if msgbox "blah blah" end if end su -- Message posted from http://www.ExcelForum.com |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
There are not very many VBA functions (none I can think of) that will
evaluate multiple cells as an argument. This is an illegal construct anyway: Len(vdata.Cell).Value len returns a number - a number certainly doesn't have a Value property. Dim bBad as Boolean Dim cell as Range bBad = False for each cell in Range("c7:j7") if not isnumeric(cell) then bBad = True exit sub Next if bBad then msgbox "All data must be numeric" End if -- Regards, Tom Ogilvy mikewild2000 wrote in message ... Tom, what about the Len function, as this does not work either. Dim vdata As Range, Cell As Range Set vdata = Range("c7:j7") If Len(vdata.Cell).Value Then exit sub end if msgbox "blah blah" end if end sub --- Message posted from http://www.ExcelForum.com/ |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sorry to my fault
On the numeric topic i took you advice and used data\validate from th tools menu. But could the len function validate that a group of cells only have numbers or less in each cell -- Message posted from http://www.ExcelForum.com |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
finding only cells with a numeric value | Excel Discussion (Misc queries) | |||
How did I make my column headings become numeric (1 2 3) | New Users to Excel | |||
How do I make letters not show up in a alpha-numeric string? | Excel Worksheet Functions | |||
Is it possible to make excel NOT process non-numeric cell data in formulae | Excel Discussion (Misc queries) | |||
The colums changed from alpha to numeric how do you make it alpha | Excel Discussion (Misc queries) |