Richard, you can try this code (inserting your code where indicated).
Sub Email()
Dim counter As Integer
For counter = 1 To ActiveWorkbook.Sheets.Count
If Sheets(counter).Range("E1") <> "" Then
'Insert your code here
End If
Next counter
End Sub
Hope this helps.
Barrie
Barrie Davidson
Sub Email()
Dim counter As Integer
For counter = 1 To ActiveWorkbook.Sheets.Count
If Sheets(counter).[E1] <> "" Then
If IsNumeric(WorksheetFunction.Search("@", Sheets(Counter).[E1])) then
'Insert your code here
End If
End If
Next counter
End Sub
Juan Pablo
I'll give it a try. Thanks guys
Hi guys,
For some reason, the code below wasn't actually selecting the next sheet. I've posted below the code I've ended up with which works fine until it gets to the last sheet, and of course it stops, can't select the next sheet. This is not a major issue, as I am the one using it and don't really care, but if someone else is doing my job, it would be nice if it returned the first sheet on completion. Any ideas?
Richard
Sub Send_New()
'
' Send_New Macro
' Macro recorded 5/07/2001 by Richard.Staude
'
'
Application.ScreenUpdating = False
Sheets("Sheet Index").Select
Application.DisplayAlerts = False
Dim counter As Integer
For counter = 1 To ActiveWorkbook.Sheets.Count
If Sheets(counter).[E1] <> "" Then
Workbooks.Add Template:="Workbook"
ActiveSheet.PageSetup.Orientation = xlLandscape
ActiveWorkbook.SaveAs Filename:="C:\Send Budget.xls", _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
Windows("Report.xls").Activate
Application.Goto Reference:="Print_Area"
Selection.Copy
Windows("Send Budget").Activate
Range("A1").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Selection.PasteSpecial Paste:=xlFormats, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Selection.Columns.AutoFit
Windows("Report.xls").Activate
Range("E1").Select
Application.CutCopyMode = False
Selection.Copy
Windows("Send Budget").Activate
Range("A52").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Range("A1").Select
ActiveWorkbook.SendMail Recipients:=Range("A52")
ActiveWorkbook.Close SaveChanges:=False
End If
ActiveSheet.Next.Select
Next counter
Application.DisplayAlerts = True
End Sub
For some reason, the code below wasn't actually selecting the next sheet. I've posted below the code I've ended up with which works fine until it gets to the last sheet, and of course it stops, can't select the next sheet. This is not a major issue, as I am the one using it and don't really care, but if someone else is doing my job, it would be nice if it returned the first sheet on completion. Any ideas? Sub Send_New() Send_New Macro Macro recorded 5/07/2001 by Richard.Staude '
Richard, just insert this code (I assume your first worksheet is named "Sheet Index") before your last line of code (display alerts).
Sheets("Sheet Index").Activate
Regards,
BarrieBarrie Davidson