Excel VBA Extract domain name from email address using Excel VBA Macro
How to Extract, follow steps as below:
Step 1 : Split email id from @ sign
Step 2: Get second portion of split result
Step 3: Now in domain name there could be more than one dots, so we will split value in step 2 using "." sign
Step 4: Store values so split in to array & remove last array
Step 5 : Remove last array value
Step 6 : Join array value using "."
Step 7: Result is your domain name
Check Code:
Method 2 ***
How to Extract, follow steps as below:
Step 1 : Split email id from @ sign
Step 2: Get second portion of split result
Step 3: Now in domain name there could be more than one dots, so we will split value in step 2 using "." sign
Step 4: Store values so split in to array & remove last array
Step 5 : Remove last array value
Step 6 : Join array value using "."
Step 7: Result is your domain name
Check Code:
Sub domain_name_old() Dim a() As String Dim domain As String domain = "vba@sub.domain.com" 'ActiveCell.Value domain = Split(domain, "@")(1) a = Split(domain, ".") ReDim Preserve a(UBound(a) - 1) domain = Join(a, ".") MsgBox "Domain name is : " & domain End Sub
Method 2 ***
Sub domain_name2()Dim a() As StringDim domain As Stringdomain = ActiveCell.Valuedomain = Split(domain, "@")(1)domain = Replace(domain, "." & Right(domain, (Len(domain) - InStrRev(domain, "."))), "")End Sub
In seven other states, there's be} some type of pending legislation. Charles is a nationally recognized capital markets specialist and educator with over 30 years of expertise developing in-depth training programs for burgeoning financial professionals. Charles has taught at a number of|numerous|a selection of} institutions including Goldman Sachs, Morgan Stanley, Societe Generale, tons 벳익스플로어 of|and a lot of} extra. Sign up for a Club Sycuan card today and you’ll mechanically turn into a Gold cardholder.
ReplyDelete