Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
sd sd is offline
external usenet poster
 
Posts: 9
Default changing a section of text

I have a macro that runs two queries and returns the data to a repot. I
need to be able to edit two dates in two different locations each time
the macro runs. Is there a simple way of doing this by entering the
values on the spreadsheet? The dates 30-aug-2005 and 31-aug-2005 are
what I need to change.

Thanks in advance for any help you can give.

Private Sub CommandButton1_Click()

Sheets("Sheet1").Select
ActiveSheet.PivotTableWizard SourceType:=xlExternal,
SourceData:=Array( _
"SELECT ss_hist_base.mach_name, ss_hist_base.shift_id,
Sum(ss_hist_base.total_down_time)" & Chr(13) & "" & Chr(10) & "FROM
plantstar.ss_hist_base ss_hist_base" & Chr(13) & "" & Chr(10) & "WHERE
(ss_hist_base.start_time='30-aug-2005 07:00:00' And ss_hist_ba" _
, _
"se.start_time<'31-aug-2005 07:00:00')" & Chr(13) & "" &
Chr(10) & "GROUP BY ss_hist_base.mach_name, ss_hist_base.shift_id" _
), Connection:= _

"ODBC;DSN=OPENINGRES;SERVER=PLANTSTAR;DATABASE=foc us2000;SERVERTYPE=INGRES"
ActiveSheet.PivotTables("PivotTable2").SmallGrid = False
ActiveSheet.PivotTables("PivotTable2").AddFields
RowFields:=Array("mach_name" _
, "shift_id", "col3")
Sheets("report").Select
Sheets("sheet3").Select

ActiveSheet.PivotTableWizard SourceType:=xlExternal,
SourceData:=Array( _
"SELECT ss_hist_base.mach_name, ss_hist_base.tool,
ss_hist_base.shift_id, Sum(ss_hist_base.total_down_time)" & Chr(13) &
"" & Chr(10) & "FROM plantstar.ss_hist_base ss_hist_base" & Chr(13) &
"" & Chr(10) & "WHERE (ss_hist_base.start_time='30-aug-2005 07:00" _
, _
":00' And ss_hist_base.start_time<'31-aug-2005 07:00:00')" &
Chr(13) & "" & Chr(10) & "GROUP BY ss_hist_base.mach_name,
ss_hist_base.tool, ss_hist_base.shift_id" _
), Connection:= _

"ODBC;DSN=OPENINGRES;SERVER=PLANTSTAR;DATABASE=foc us2000;SERVERTYPE=INGRES"
ActiveSheet.PivotTables("PivotTable1").SmallGrid = False
ActiveSheet.PivotTables("PivotTable1").AddFields
RowFields:="mach_name", _
ColumnFields:="tool"
Sheets("report").Select
End Sub

Reply
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
Limit long text to right footer section LauriS Excel Discussion (Misc queries) 4 December 11th 07 03:01 PM
Get section of text from cell Kees Vos[_2_] Excel Worksheet Functions 6 December 7th 07 10:02 PM
Wrap text in header section Excel 2007 Ted M H Excel Discussion (Misc queries) 2 November 10th 07 06:36 PM
Converting selected section of text to numbers Rob Excel Discussion (Misc queries) 6 March 8th 05 01:52 AM
Stripping section of text Philippe L. Balmanno Excel Worksheet Functions 3 December 30th 04 03:36 PM


All times are GMT +1. The time now is 01:12 PM.

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"