![]() |
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 |
All times are GMT +1. The time now is 12:35 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com