I have a list of email addresses, and I need to find what all the
domains are and how often each domain occurs. I can do everything
in excel once I strip everything but the domain from the email
addresses.
I wrote this to look at each address and delete each character until
it gets to an @, at which point it pastes what it has in the next
column and advances to the next email address.
I'm doing something wrong with my string handling though, as I'm
getting an "Invalid Qualifier" messege when I get to
If myEmail.substring(Char, 1) <> "@" Then
Can anyone point out what I'm doing wrong?
Dim myEmail As String
Dim Row As Integer
Dim TotalRow As Integer
Dim Char As Integer
Dim Counter As Integer
Row = 1
Char = 1
TotalRow = ActiveSheet.UsedRange.Rows.Count
For Row = 1 To TotalRow Step 1
For Counter = 1 To 30 Step 1
Email = Cells(Row, 1).Value
If myEmail.substring(Char, 1) <> "@" Then
myEmail.substring(Char, 1) = ""
Counter = Counter + 1
Char = Char + 1
End If
Next Counter
Cells(Row, 3).Value = Email
Next Row
End Sub