Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 79
Default Merge all files in a folder

Hi all

I am using the the codes in Merge a range from all workbooks in a folder
with AutoFilter provided by Ron de Bruin

Is it possible to have two auto filters enable in the codes? if tes,
How do I write the additional syntax to filter for NonBlanks rows in column
C given that the current codes provided wrote as :

FilterField = 2
SearchValue = "Y"

Thanks for your assistance

regards, francis

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Merge all files in a folder

Hi franciz

For others this is the code page (last example)
http://www.rondebruin.nl/copy3.htm

We can add one line

Replace this:
sourceRange.AutoFilter Field:=FilterField, _
Criteria1:=SearchValue


With:

'Filter the range on the FilterField column
sourceRange.AutoFilter Field:=FilterField, _
Criteria1:=SearchValue

sourceRange.AutoFilter Field:=3, Criteria1:="<"





--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"franciz" wrote in message ...
Hi all

I am using the the codes in Merge a range from all workbooks in a folder
with AutoFilter provided by Ron de Bruin

Is it possible to have two auto filters enable in the codes? if tes,
How do I write the additional syntax to filter for NonBlanks rows in column
C given that the current codes provided wrote as :

FilterField = 2
SearchValue = "Y"

Thanks for your assistance

regards, francis

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 79
Default Merge all files in a folder

Hi Ron,

Thanks, this work great. I need two more modification in the excellent codes
of yours.

Is it also possible to have the header include, my source files headers in
on row 2. I have tried to modify the below to include a header but was
unsucessful.

' Set a range without the Header row
Set rng = .Resize(.Rows.Count - 1,
..Columns.Count). _
Offset(1,
0).SpecialCells(xlCellTypeVisible)

In addition, I would like the new workbook name as "Utility" rather than
"Sheet1".
Embarrass to say that I could not find the codes that mentioned naming the
workbook as "Sheet1"

Thank you for your assistance

regards, francis

"Ron de Bruin" wrote:

Hi franciz

For others this is the code page (last example)
http://www.rondebruin.nl/copy3.htm

We can add one line

Replace this:
sourceRange.AutoFilter Field:=FilterField, _
Criteria1:=SearchValue


With:

'Filter the range on the FilterField column
sourceRange.AutoFilter Field:=FilterField, _
Criteria1:=SearchValue

sourceRange.AutoFilter Field:=3, Criteria1:="<"





--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"franciz" wrote in message ...
Hi all

I am using the the codes in Merge a range from all workbooks in a folder
with AutoFilter provided by Ron de Bruin

Is it possible to have two auto filters enable in the codes? if tes,
How do I write the additional syntax to filter for NonBlanks rows in column
C given that the current codes provided wrote as :

FilterField = 2
SearchValue = "Y"

Thanks for your assistance

regards, francis


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Merge all files in a folder

Use

Set rng = .SpecialCells(xlCellTypeVisible)


You must save the file before Sheet1 will be changed
If you create a one sheet workbook like I do in the code the name is automatic Sheet1

After this line
BaseWks.Columns.AutoFit

Add
BaseWks.SaveAs "C:\Utility.xls"

If you want to close it add this one also
BaseWks.Close False

What do you want to do if there is alrewady a file with that name?
Replace ?

You can add the date/time to the file name for example


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"franciz" wrote in message ...
Hi Ron,

Thanks, this work great. I need two more modification in the excellent codes
of yours.

Is it also possible to have the header include, my source files headers in
on row 2. I have tried to modify the below to include a header but was
unsucessful.

' Set a range without the Header row
Set rng = .Resize(.Rows.Count - 1,
.Columns.Count). _
Offset(1,
0).SpecialCells(xlCellTypeVisible)

In addition, I would like the new workbook name as "Utility" rather than
"Sheet1".
Embarrass to say that I could not find the codes that mentioned naming the
workbook as "Sheet1"

Thank you for your assistance

regards, francis

"Ron de Bruin" wrote:

Hi franciz

For others this is the code page (last example)
http://www.rondebruin.nl/copy3.htm

We can add one line

Replace this:
sourceRange.AutoFilter Field:=FilterField, _
Criteria1:=SearchValue


With:

'Filter the range on the FilterField column
sourceRange.AutoFilter Field:=FilterField, _
Criteria1:=SearchValue

sourceRange.AutoFilter Field:=3, Criteria1:="<"





--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"franciz" wrote in message ...
Hi all

I am using the the codes in Merge a range from all workbooks in a folder
with AutoFilter provided by Ron de Bruin

Is it possible to have two auto filters enable in the codes? if tes,
How do I write the additional syntax to filter for NonBlanks rows in column
C given that the current codes provided wrote as :

FilterField = 2
SearchValue = "Y"

Thanks for your assistance

regards, francis


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 79
Default Merge all files in a folder

Hi Ron,

Thank for assisting in this, I appreciate your effort and patience.

1) Using this line : Set rng = .SpecialCells(xlCellTypeVisible)
will include header row which is on the row 1 of the source files, but
my header row from the source files start at row 2. How do I change this?

2) Quote " You can add the date/time to the file name for example "

This is a good idea as it allow me to save different file names and keep it
for
a period just in case I need to refer back to what have been done.How do I
add this into the line. Appreciate your help in this.


Thanks in advance

regards, francis



"Ron de Bruin" wrote:

Use

Set rng = .SpecialCells(xlCellTypeVisible)


You must save the file before Sheet1 will be changed
If you create a one sheet workbook like I do in the code the name is automatic Sheet1

After this line
BaseWks.Columns.AutoFit

Add
BaseWks.SaveAs "C:\Utility.xls"

If you want to close it add this one also
BaseWks.Close False

What do you want to do if there is alrewady a file with that name?
Replace ?

You can add the date/time to the file name for example


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"franciz" wrote in message ...
Hi Ron,

Thanks, this work great. I need two more modification in the excellent codes
of yours.

Is it also possible to have the header include, my source files headers in
on row 2. I have tried to modify the below to include a header but was
unsucessful.

' Set a range without the Header row
Set rng = .Resize(.Rows.Count - 1,
.Columns.Count). _
Offset(1,
0).SpecialCells(xlCellTypeVisible)

In addition, I would like the new workbook name as "Utility" rather than
"Sheet1".
Embarrass to say that I could not find the codes that mentioned naming the
workbook as "Sheet1"

Thank you for your assistance

regards, francis

"Ron de Bruin" wrote:

Hi franciz

For others this is the code page (last example)
http://www.rondebruin.nl/copy3.htm

We can add one line

Replace this:
sourceRange.AutoFilter Field:=FilterField, _
Criteria1:=SearchValue


With:

'Filter the range on the FilterField column
sourceRange.AutoFilter Field:=FilterField, _
Criteria1:=SearchValue

sourceRange.AutoFilter Field:=3, Criteria1:="<"





--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"franciz" wrote in message ...
Hi all

I am using the the codes in Merge a range from all workbooks in a folder
with AutoFilter provided by Ron de Bruin

Is it possible to have two auto filters enable in the codes? if tes,
How do I write the additional syntax to filter for NonBlanks rows in column
C given that the current codes provided wrote as :

FilterField = 2
SearchValue = "Y"

Thanks for your assistance

regards, francis





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Merge all files in a folder

Hi francis


Change

RangeAddress = Range("A1:G" & Rows.Count).Address

To

RangeAddress = Range("A2:G" & Rows.Count).Address
Change the Column to yours


Use this to save

BaseWks.SaveAs "C:\Utility " & Format(Now, "yyyy-mm-dd h-mm-ss") & ".xls"



--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"franciz" wrote in message ...
Hi Ron,

Thank for assisting in this, I appreciate your effort and patience.

1) Using this line : Set rng = .SpecialCells(xlCellTypeVisible)
will include header row which is on the row 1 of the source files, but
my header row from the source files start at row 2. How do I change this?

2) Quote " You can add the date/time to the file name for example "

This is a good idea as it allow me to save different file names and keep it
for
a period just in case I need to refer back to what have been done.How do I
add this into the line. Appreciate your help in this.


Thanks in advance

regards, francis



"Ron de Bruin" wrote:

Use

Set rng = .SpecialCells(xlCellTypeVisible)


You must save the file before Sheet1 will be changed
If you create a one sheet workbook like I do in the code the name is automatic Sheet1

After this line
BaseWks.Columns.AutoFit

Add
BaseWks.SaveAs "C:\Utility.xls"

If you want to close it add this one also
BaseWks.Close False

What do you want to do if there is alrewady a file with that name?
Replace ?

You can add the date/time to the file name for example


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"franciz" wrote in message ...
Hi Ron,

Thanks, this work great. I need two more modification in the excellent codes
of yours.

Is it also possible to have the header include, my source files headers in
on row 2. I have tried to modify the below to include a header but was
unsucessful.

' Set a range without the Header row
Set rng = .Resize(.Rows.Count - 1,
.Columns.Count). _
Offset(1,
0).SpecialCells(xlCellTypeVisible)

In addition, I would like the new workbook name as "Utility" rather than
"Sheet1".
Embarrass to say that I could not find the codes that mentioned naming the
workbook as "Sheet1"

Thank you for your assistance

regards, francis

"Ron de Bruin" wrote:

Hi franciz

For others this is the code page (last example)
http://www.rondebruin.nl/copy3.htm

We can add one line

Replace this:
sourceRange.AutoFilter Field:=FilterField, _
Criteria1:=SearchValue


With:

'Filter the range on the FilterField column
sourceRange.AutoFilter Field:=FilterField, _
Criteria1:=SearchValue

sourceRange.AutoFilter Field:=3, Criteria1:="<"





--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"franciz" wrote in message ...
Hi all

I am using the the codes in Merge a range from all workbooks in a folder
with AutoFilter provided by Ron de Bruin

Is it possible to have two auto filters enable in the codes? if tes,
How do I write the additional syntax to filter for NonBlanks rows in column
C given that the current codes provided wrote as :

FilterField = 2
SearchValue = "Y"

Thanks for your assistance

regards, francis



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
merge two excel files like in word mail merge azmerritt Excel Discussion (Misc queries) 1 December 11th 16 09:23 PM
Pulling pdf files from general folder to specific folder [email protected] Excel Discussion (Misc queries) 2 September 8th 09 09:41 PM
User selection of folder and open all .xls files within folder Barb Reinhardt Excel Programming 4 April 14th 07 01:41 PM
how can I specific a folder with wildcard criteria and excel will import all the correct files in that folder? Raven Excel Discussion (Misc queries) 1 January 24th 06 03:28 PM
how can I specific a folder with wildcard criteria and excel will import all the correct files in that folder? Raven[_2_] Excel Programming 1 January 24th 06 04:23 AM


All times are GMT +1. The time now is 10:49 PM.

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"