Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Text Import Wizard

Need to be able to:
1) Allow for a prompt so can navigate to a text file within the text
import wizard
2) Filter the list of dates to remove weekends from the list after the
import has taken place
3) Set up a dynamic (each time this is ran there will be more entries
so this can't be limited to a range) pivot table to group each week
together and provide the Max figure of the number field for that week.


Mini sample of data
Client Date Time Number
888 06/01/2004 11:23:29 381
888 06/01/2004 12:23:29 1
888 07/01/2004 03:23:30 5
888 07/01/2004 04:23:29 6
888 08/01/2004 22:23:29 6
888 08/01/2004 23:23:30 9
888 09/01/2004 00:23:30 7
888 09/01/2004 01:23:30 7
888 15/01/2004 12:23:30 273
888 15/01/2004 13:23:30 225
888 15/01/2004 14:23:30 285
888 15/01/2004 15:23:30 261

Any help on this would be really appreciated - Many Thanks, Al (
)
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 599
Default Text Import Wizard

Al

Try this

Sub ImportTextFile()

Dim cell As Range
Dim Fname As String
Dim Sh As Worksheet
Dim i As Long
Dim Prng As Range
Dim Pt As PivotTable

Fname = Application.GetOpenFilename(",*.txt")

Workbooks.OpenText Filename:=Fname, _
Origin:=xlWindows, _
StartRow:=1, _
DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=True, _
Tab:=True, Semicolon:=False, Comma:=False, _
Space:=True, Other:=False, _
FieldInfo:=Array(Array(1, 1), Array(2, 4), Array(3, 1), Array(4, 1))

Set Sh = ActiveWorkbook.Sheets(1)

For i = Sh.Range("b2").End(xlDown).Row To 2 Step -1
If Application.Weekday(Sh.Cells(i, 2).Value) = 7 Or _
Application.Weekday(Sh.Cells(i, 2).Value) = 1 Then

Sh.Cells(i, 1).EntireRow.Delete
End If
Next i

Sh.Range("e1").Value = "Week"

For Each cell In Sh.Range("b2", Sh.Range("b2").End(xlDown)).Cells
cell.Offset(0, 3).Formula = "=WEEKNUM(" & cell.Address & ")"
Next cell

Set Prng = Sh.Range("B2").CurrentRegion

Set Pt = Sh.Parent.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _
Prng.Address).CreatePivotTable(TableDestination:=R ange("H17"), _
TableName:="PivotTable1")

Pt.PivotFields("Week").Orientation = xlRowField
Pt.PivotFields("Number").Orientation = xlDataField
Pt.PivotFields("Sum of Number").Function = xlMax

End Sub

--
Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.

"Al Mackay" wrote in message
om...
Need to be able to:
1) Allow for a prompt so can navigate to a text file within the text
import wizard
2) Filter the list of dates to remove weekends from the list after the
import has taken place
3) Set up a dynamic (each time this is ran there will be more entries
so this can't be limited to a range) pivot table to group each week
together and provide the Max figure of the number field for that week.


Mini sample of data
Client Date Time Number
888 06/01/2004 11:23:29 381
888 06/01/2004 12:23:29 1
888 07/01/2004 03:23:30 5
888 07/01/2004 04:23:29 6
888 08/01/2004 22:23:29 6
888 08/01/2004 23:23:30 9
888 09/01/2004 00:23:30 7
888 09/01/2004 01:23:30 7
888 15/01/2004 12:23:30 273
888 15/01/2004 13:23:30 225
888 15/01/2004 14:23:30 285
888 15/01/2004 15:23:30 261

Any help on this would be really appreciated - Many Thanks, Al (
)



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
How to Start Excel in Text Import Wizard for data import rlelvis Setting up and Configuration of Excel 0 July 10th 08 08:40 PM
Help with Text Import Wizard beth Excel Discussion (Misc queries) 1 April 23rd 08 04:30 AM
Text Import Wizard dan Excel Worksheet Functions 2 August 8th 06 04:58 PM
Text Import Wizard Duncan Help Excel Discussion (Misc queries) 1 July 27th 06 03:38 PM
Text Import Wizard Pieter G Excel Discussion (Misc queries) 1 July 18th 05 11:49 AM


All times are GMT +1. The time now is 02:46 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"