![]() |
Validate Excel Range with RegEx
Any thoughts on how to validate an Excel range with RegEx?
Acceptable inputs would include $A1:$BD25, C:C, B4 etc. I'm close to coming up with an answer but I'm not sure how to stop invalid range references such as C3:A2 from being accepted. Thanks. |
Validate Excel Range with RegEx
You could try something like this. But be aware that "C3:A2" is a perfectly
valid range string. Even thought Excel will turn it around for presentation/display purposes that doesn't mean it's invalid. Sub Test() MsgBox RgValid("ZC3:A2") End Sub Function RgValid(RgStr) As Boolean Dim Rg As Range On Error GoTo ExitThis Set Rg = Range(RgStr) RgValid = True Exit Function ExitThis: End Function -- Jim Rech Excel MVP |
All times are GMT +1. The time now is 01:43 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com