![]() |
Telephone number data type?
Hi,
I'm trying to write a program using a spreadsheet that has two columns for the telephone number: the first is the actual telephone number, but in some cases it refers to the data circuit and the actual tel no is in the second column. I can tell if the tel no is a circuit by the number being AREA CODE and then a 1, followed by 6 digits (for example, 4161334444). I need to figure out how to use the second column of telephone numbers when this happens (which is only about 3% of the time, but these are critical to my business). But for some reason, I cannot figure out what data type i need to use (I've tried string, variant, and integer) all to no avail... Right now, the code looks like this (feel free to laugh, i've been working on this for about 35 hours since Thursday morning and am a wee bit fried)... Dim Telno As String Dim Auxno As String If Range("Telno") = "5191*" Then Range("Auxno").Copy Range("Telno").Paste End If End Sub I would appreciate any help as soon as possible.....I need this program up and running by tomorrow afternoon...groan... Chris |
Telephone number data type?
I think you need to use text strings as in your example. You need to
distinguish a circuit number from a phone number and you state a circuit number is an area code followed by a "1" followed by only six digits. This is 10 digits, the same as a phone number. Since you can't use length to distinguish, use the fourth character in the string: =MID(A1,4,1) If this is a "1", its a circuit number and get the phone number elsewhere. -- Gary''s Student "ChrisBat" wrote: Hi, I'm trying to write a program using a spreadsheet that has two columns for the telephone number: the first is the actual telephone number, but in some cases it refers to the data circuit and the actual tel no is in the second column. I can tell if the tel no is a circuit by the number being AREA CODE and then a 1, followed by 6 digits (for example, 4161334444). I need to figure out how to use the second column of telephone numbers when this happens (which is only about 3% of the time, but these are critical to my business). But for some reason, I cannot figure out what data type i need to use (I've tried string, variant, and integer) all to no avail... Right now, the code looks like this (feel free to laugh, i've been working on this for about 35 hours since Thursday morning and am a wee bit fried)... Dim Telno As String Dim Auxno As String If Range("Telno") = "5191*" Then Range("Auxno").Copy Range("Telno").Paste End If End Sub I would appreciate any help as soon as possible.....I need this program up and running by tomorrow afternoon...groan... Chris |
Telephone number data type?
Boy, I've obviously been drinking too much coffee (or not
enough......)....That's such a simple answer, why was I looking for something more complicated? :-) Thanks a lot, Chris "Gary''s Student" wrote: I think you need to use text strings as in your example. You need to distinguish a circuit number from a phone number and you state a circuit number is an area code followed by a "1" followed by only six digits. This is 10 digits, the same as a phone number. Since you can't use length to distinguish, use the fourth character in the string: =MID(A1,4,1) If this is a "1", its a circuit number and get the phone number elsewhere. -- Gary''s Student "ChrisBat" wrote: Hi, I'm trying to write a program using a spreadsheet that has two columns for the telephone number: the first is the actual telephone number, but in some cases it refers to the data circuit and the actual tel no is in the second column. I can tell if the tel no is a circuit by the number being AREA CODE and then a 1, followed by 6 digits (for example, 4161334444). I need to figure out how to use the second column of telephone numbers when this happens (which is only about 3% of the time, but these are critical to my business). But for some reason, I cannot figure out what data type i need to use (I've tried string, variant, and integer) all to no avail... Right now, the code looks like this (feel free to laugh, i've been working on this for about 35 hours since Thursday morning and am a wee bit fried)... Dim Telno As String Dim Auxno As String If Range("Telno") = "5191*" Then Range("Auxno").Copy Range("Telno").Paste End If End Sub I would appreciate any help as soon as possible.....I need this program up and running by tomorrow afternoon...groan... Chris |
Telephone number data type?
Thanks for the feed-back. Next time don't wait 35 hours to post.
-- Gary''s Student "ChrisBat" wrote: Boy, I've obviously been drinking too much coffee (or not enough......)....That's such a simple answer, why was I looking for something more complicated? :-) Thanks a lot, Chris "Gary''s Student" wrote: I think you need to use text strings as in your example. You need to distinguish a circuit number from a phone number and you state a circuit number is an area code followed by a "1" followed by only six digits. This is 10 digits, the same as a phone number. Since you can't use length to distinguish, use the fourth character in the string: =MID(A1,4,1) If this is a "1", its a circuit number and get the phone number elsewhere. -- Gary''s Student "ChrisBat" wrote: Hi, I'm trying to write a program using a spreadsheet that has two columns for the telephone number: the first is the actual telephone number, but in some cases it refers to the data circuit and the actual tel no is in the second column. I can tell if the tel no is a circuit by the number being AREA CODE and then a 1, followed by 6 digits (for example, 4161334444). I need to figure out how to use the second column of telephone numbers when this happens (which is only about 3% of the time, but these are critical to my business). But for some reason, I cannot figure out what data type i need to use (I've tried string, variant, and integer) all to no avail... Right now, the code looks like this (feel free to laugh, i've been working on this for about 35 hours since Thursday morning and am a wee bit fried)... Dim Telno As String Dim Auxno As String If Range("Telno") = "5191*" Then Range("Auxno").Copy Range("Telno").Paste End If End Sub I would appreciate any help as soon as possible.....I need this program up and running by tomorrow afternoon...groan... Chris |
All times are GMT +1. The time now is 12:47 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com