Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Macro Creation

I need to create a macro that does all of the following in order;

I open a new workbook and start my macro which
1. goes to a specific folder and opens all of the files in there (excell
spreadsheets)
2. for each file I need the macro to highlight all of column g and do a
"text to column" with the output being input into the workbook I opened at
the start with the output from each individual file being inserted under the
output from the last one.

Is this possible?

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 137
Default Macro Creation

Martina,

Why don't you do it once with the macro recorder on ... it will store
precisely all your steps ...
HTH

Carim

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Macro Creation

Well, basically the point behind this is, i need to open all of the files
that are in a folder, and this needs to be done at the end of each month (it
is to create monthly reports).

But there could be 2 files in there at the end of one month and then at the
end of the next month their might be 20.



"Carim" wrote:

Martina,

Why don't you do it once with the macro recorder on ... it will store
precisely all your steps ...
HTH

Carim


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 137
Default Macro Creation

Martina,

Then you should try in the object "In this Workbook" an automatic open
such as

Private Sub Workbook_Open()
Workbooks.Open("D:\My Documents\Excel\Data Files.xls")
End Sub

HTH
Carim

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default Macro Creation

Option Explicit

Sub GetData()

Dim rw As Long
Dim sfile As String
Dim wb As Workbook ' book being opend
Dim ws As Worksheet
Dim wsResult As Worksheet
Dim wbResult As Workbook
Dim root As String
Dim source As Range

rw = 1
root = "C:\temp\*.xls"

sfile = Dir(root)
If sfile = "" Then
MsgBox "Nofiles found!"
Else

Set wbResult = Workbooks.Add(xlWBATWorksheet)
Set wsResult = wbResult.ActiveSheet

Do

Set wb = Workbooks.Open(sfile)
Set ws = wb.ActiveSheet
With ws
Set source = .Range(.Range("G1"), .Range("G1").End(xlDown))
End With
With wsResult
.Cells(rw, 1).Resize(source.Rows.Count, 1).Value =
source.Value
End With
rw = rw + source.Rows.Count
wb.Close False

sfile = Dir()
Loop Until sfile = ""

MsgBox "Done"
End If

' now add the code to text to column for the resulting column A

End Sub

Patrick Molloy
Microsoft Excel MVP


"MartinaL" wrote:

I need to create a macro that does all of the following in order;

I open a new workbook and start my macro which
1. goes to a specific folder and opens all of the files in there (excell
spreadsheets)
2. for each file I need the macro to highlight all of column g and do a
"text to column" with the output being input into the workbook I opened at
the start with the output from each individual file being inserted under the
output from the last one.

Is this possible?

Thanks

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
Macro creation Ojunera Excel Worksheet Functions 0 October 6th 08 06:28 PM
Creation of macro with an example Jothirmaya Excel Discussion (Misc queries) 2 November 30th 05 12:10 AM
Macro Creation Programming Cells Excel Discussion (Misc queries) 3 July 28th 05 06:07 PM
XML creation via a macro Sarah Dos Santos Excel Programming 1 February 10th 05 12:57 PM
Macro Creation wiinc1 Excel Programming 4 May 18th 04 01:24 PM


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