LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel Validation Problem in VB6

I am trying to have certain cells to be validated for decimals as a
user makes an input into Excel cells.

I create an Excel file in my VB6 code and I have the following code
for validation in my VB6:

m_objExcel.ActiveSheet.Range("k1:k" & CStr(iCells + 1)).Select
For Each rng In m_objExcel.ActiveSheet.Range("k1:k" & CStr(iCells))
With rng.Validation
.Add Type:=xlValidateDecimal, AlertStyle:=xlValidAlertStop,
Operator:=xlBetween, Formula1:="0", Formula2:="10000000"
.ErrorMessage = "Please enter a number from 0 to 10000000"
End With
Next rng

The code compiles and runs fine, but no validation is being performed
when I try to enter "abc" in a k row (the row I am validating in the
code above.)
(I also tried Formula1:="=0", Formula2:="=10000000")

Please give me a hand. I am completing my project and this is the only
problem that holds me up now.

Thanks anyone!!

Yuri
 
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
Validation Problem Charles Excel Discussion (Misc queries) 3 August 25th 08 01:50 PM
macro Excel problem link cells with Data-Validation option [email protected] Excel Discussion (Misc queries) 3 March 26th 08 09:20 AM
Problem with length of validation list in Excel 2002 Vladimir Excel Worksheet Functions 4 December 15th 06 04:33 AM
Tricky problem in Data validation - Excel 2003 smadhuranath Excel Discussion (Misc queries) 1 July 18th 06 09:10 AM
Validation problem... BeSmart Excel Worksheet Functions 3 July 7th 05 02:22 AM


All times are GMT +1. The time now is 06:36 AM.

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"