boliver228
New Member
- Joined
- Feb 15, 2013
- Messages
- 15
Hi,
I have a macro which submits a spreadsheet to an excel site. The macro checks that a number of compulsory fields are populated before it allow this spreadsheet to be submitted, and if any checks fail, it displays a message box and exits the macro.
One of the checks is to make sure a cell [CRM_Reference] contains either a 6 or 9 digit integer. I've tried the code below but it doesn't work
Dim Chars1 as Integer
Dim Chars2 as Integer
Chars1= 9
Chars2 = 9
If Len(Range("CRM_Reference").Text)) <> Chars 1 Or Len(Range("CRM_Reference").Text)) <> Chars 2 Then
MsgBox "Insert Message Here"
Exit Sub
End If
Any ideas why not?
I have a macro which submits a spreadsheet to an excel site. The macro checks that a number of compulsory fields are populated before it allow this spreadsheet to be submitted, and if any checks fail, it displays a message box and exits the macro.
One of the checks is to make sure a cell [CRM_Reference] contains either a 6 or 9 digit integer. I've tried the code below but it doesn't work
Dim Chars1 as Integer
Dim Chars2 as Integer
Chars1= 9
Chars2 = 9
If Len(Range("CRM_Reference").Text)) <> Chars 1 Or Len(Range("CRM_Reference").Text)) <> Chars 2 Then
MsgBox "Insert Message Here"
Exit Sub
End If
Any ideas why not?