LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
Kam Kam is offline
external usenet poster
 
Posts: 57
Default automatically run a macro everyday

Dear all,

I am going for vacation in two days. I need to run my VBA code automatically.

Everyday, I get one excel workbook by using another macro. This workbook
contains some values.

I have written a vba code in Excel_Macro.xls which does the work for me.
This vba code generates Pivot table in sheets in to Excel_Macro.xls.

Script In Excel_Macro.xls
Sheets("Pivot_Table").Select

With Worksheets("Pivot_Table")

Range("A:K").Select
With Selection
Cells.Clear
End With

Dim PT_9_Cache As PivotCache, PT_9 As PivotTable
Set PT_9_Cache =
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatab ase,
SourceData:="Temp_Data!A:AK")
Set PT_9 =
PT_9_Cache.CreatePivotTable(TableDestination:="Piv ot_Table!R1C1",
TableName:="FACT")
With PT_9
.PivotFields(1).Orientation = xlRowField 'Department
.PivotFields(2).Orientation = xlRowField 'Status
.PivotFields(3).Orientation = xlDataField 'SeqNo
End With
With ActiveSheet.PivotTables("FACT").PivotFields("Depar tment")
.Orientation = xlRowField
.Position = 1
End With
Range("A2").Select
ActiveSheet.PivotTables("FACT").PivotFields("Count of
SeqNo").Function = xlCount
ActiveWorkbook.ShowPivotTableFieldList = True
ActiveWorkbook.ShowPivotTableFieldList = False
Range("B2").Select
ActiveSheet.PivotTables("FACT").PivotFields("Statu s").Subtotals = _
Array(False, False, False, False, False, False, False, False, False,
False, False, False)
Range("A2").Select
With ActiveSheet.PivotTables("FACT")
.ColumnGrand = False
.RowGrand = False
End With
ActiveWorkbook.ShowPivotTableFieldList = True
ActiveWorkbook.ShowPivotTableFieldList = False
Application.CommandBars("PivotTable").Visible = False
End With

Range("A:K").Select
With Selection
.Font.Size = 10
.Font.Name = "Verdana"
End With

Selection.Columns.AutoFit

End Sub

Once this script is done I want macro to send it by email to sender list.Can
this be done...I would appreciate your help in this Matter.

Best Regards,
Kam.
 
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
Auditing excel for everyday tasks test[_3_] Excel Worksheet Functions 6 March 2nd 09 12:30 PM
Auditing excel sheets for everyday task test[_3_] Excel Worksheet Functions 1 February 21st 09 12:53 PM
Display Date that does not change everyday. heater Excel Discussion (Misc queries) 4 August 27th 08 02:03 PM
Unique names in a list reported everyday Anurag Excel Worksheet Functions 3 November 8th 07 08:46 PM
Formula help ... moving to next cell everyday chisigs2 Excel Worksheet Functions 2 August 18th 05 11:55 PM


All times are GMT +1. The time now is 08:16 AM.

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

About Us

"It's about Microsoft Excel"