LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Rename active sheet to contents of specific cell

The following code sends the active sheet to a group of individuals
automatically via e-mail. . Two of the individuals will always receive
the e-mail, the third would depend upon which individual requested the
data, the third individuals name is called from a lookup table and the
corresponding e-mail address is placed into cell I10.

What I'd like to happen is that the active sheet is renamed to the
reference no. in cell B6, this sheet is then e-mailed to the
recipients. The macro works great with the exception of the renaming of
the sheet, is their a simple solution that can remedy this.

Thanks
Burl

Sub Rectangle15_Click()
Dim sh As Worksheet
Dim wb As Workbook
Dim strdate As String
Dim MyArrIndex As Long
Dim E_Mail_Count As Long
Dim cell As Range
Dim MyArr() As String
Application.ScreenUpdating = False
Worksheets("QuoteForm").Activate
Range("I10").Select
Selection.Copy
Range("L2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
For Each sh In ThisWorkbook.Worksheets
If sh.Range("L1").Value Like "?*@?*.?*" Then
strdate = Format(Now, "dd-mm-yy h-mm-ss")

E_Mail_Count =
sh.Columns("L").Cells.SpecialCells(xlCellTypeConst ants).Count
ReDim MyArr(1 To E_Mail_Count)
MyArrIndex = 1
For Each cell In
sh.Columns("L").Cells.SpecialCells(xlCellTypeConst ants)
If cell Like "*@*" Then
MyArr(MyArrIndex) = cell.Value
MyArrIndex = MyArrIndex + 1
End If
Next
ReDim Preserve MyArr(1 To MyArrIndex)

sh.Copy
Set wb = ActiveWorkbook
ActiveSheet.Name = Range("b6")
With wb
.SaveAs " " & sh.Name & " " & strdate & ".xls"
.SendMail MyArr, _
"New Quote"
.ChangeFileAccess xlReadOnly
Kill .FullName
.Close False
End With

End If
Next sh
Application.ScreenUpdating = True
Worksheets("Quote Data Entry").Activate
End Sub

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I automatically rename a sheet with the contents of a cell. michaelspearin Excel Discussion (Misc queries) 3 December 3rd 04 09:27 PM
using VBA to rename active sheet Papa Jonah Excel Programming 5 October 22nd 04 02:38 PM
Add sheet and rename with cell contents Rudy Woltner Excel Programming 4 April 22nd 04 10:44 AM
Rename active sheet Ginny[_2_] Excel Programming 2 January 9th 04 10:59 PM
Rename Active Sheet Jason[_25_] Excel Programming 2 September 21st 03 02:03 AM


All times are GMT +1. The time now is 09:19 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"