Excel 2003 VB CODING

N

Neil Holden

Can some one please look at the following and tell me why i'm getting a
mismatch error?

Set EmailAddr = Application.InputBox("Select Email Addresses, Click on the
Email Worksheet" & vbCrLf &
'"Hold down Contrl Key to select multiple addresses", Type:=8)
Destination = ""
For Each cell In EmailAddr
If Destination = "" Then
'Destination = cell
'Else
Destination = Destination & ";" & cell
'End If

Next cell
 
J

Jacob Skaria

Handle the error as below...

Sub Macro()

Dim myRange As Range

On Error Resume Next
Application.DisplayAlerts = False
Set myRange = Application.InputBox(Prompt:= _
"Select Email addresses", Type:=8)
On Error GoTo 0
Application.DisplayAlerts = True

If myRange Is Nothing Then
MsgBox "You cancelled the operation"
Exit Sub
Else
For Each cell In myRange
If cell.Text <> "" Then Destination = Destination & ";" & cell
Next
Destination = Mid(Destination, 2)
End If


End Sub
 
N

Neil Holden

Thanks for the reply Jacob, however this is a strange one, columns A, B and C
are hidden and it says operation canceled when the email address is selected.
If i unhide he columns it works?

Thanks again.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top