Attached.

---------- Forwarded message ----------
From: अनिल नारायण गवली <gawlianil8...@gmail.com>
Date: Wed, Mar 6, 2013 at 9:52 AM
Subject: Re: $$Excel-Macros$$ Folder path to be given to consolidate the
data from different files
To: excel-macros@googlegroups.com, isk1...@gmail.com


Dear Pravin,

Pl share the workbook .

Warm Regards,
Gawli Anil

On Tue, Mar 5, 2013 at 6:56 PM, Pravin Gunjal <isk1...@gmail.com> wrote:

> Hello Friends,
>
> Pl note, I am using the following VB code to gather the data from
> different sheets.  Once it was worked fine.  But now whenever I am trying
> the data is picking up from different folders/files and not from the
> current folder, where the main file (which has this code) is stored.
>
> Can anyone please suggest how to include required folder path in to the
> following code  OR  why it is not taking the current folder path in
> consideration while processing the VB.
>
> Thank you,
> Pravin Gunjal.
>
>
> ------------------------------------------------------------------------------------------------------
> Sub ConsolidateAll()
>
> '  This macro opens all Excel files in the working (default) directory,
> '  one at a time, and and copies all filled rows from the first worksheet
> '  of each to the first worksheet in this workbook (the workbook containing
> '  this macro), only copying the header row 1 once.
>
>   Dim Filename      As String
>   Dim ConsolWS      As Worksheet   'The worksheet where the data are
> consolidated
>   Dim NextRow       As Long  'Next available row in ConsolWS worksheet
>
>   Set ConsolWS = Worksheets(1)
>
>   NextRow = 1
>
>   'Look for all files ending with .xls or .xls + any character
>   'Can include entire path if desired. This example assumes working
>   'directory so no path specified.
>   Filename = Dir("*.xls?")
>
>   Do While Filename <> ""
>
>      If Filename = ThisWorkbook.Name Then GoTo SkipThis
>      Workbooks.Open Filename
>      Application.StatusBar = Filename & " added to New workbook."
>
>      'Base count of rows in each workbook on the last filled cell
>      'in column A
>      Dim LastRow       As Long  'Last row in source workbook
>      LastRow = Range("A65536").End(xlUp).Row
>      If NextRow = 1 Then
>         'copy all rows including header (row 1)
>         Range(Rows(1), Rows(LastRow)).Copy
> Destination:=ConsolWS.Rows(NextRow)
>         NextRow = NextRow + LastRow      'increment nextrow by number of
> rows copied
>      Else
>         'copy all rows except row 1
>         Range(Rows(2), Rows(LastRow)).Copy
> Destination:=ConsolWS.Rows(NextRow)
>         NextRow = NextRow + LastRow - 1  'increment nextrow by number of
> rows copied
>      End If
>
>      ActiveWorkbook.Close
>      Application.StatusBar = Filename & " closed."
>
> SkipThis:
>      'read next filename
>      Filename = Dir()
>   Loop
>
>   Application.StatusBar = False    'reset statusbar
>
> End Sub
>
>  --
> Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s
> =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @
> https://www.facebook.com/discussexcel
>
> FORUM RULES
>
> 1) Use concise, accurate thread titles. Poor thread titles, like Please
> Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice
> will not get quick attention or may not be answered.
> 2) Don't post a question in the thread of another member.
> 3) Don't post questions regarding breaking or bypassing any security
> measure.
> 4) Acknowledge the responses you receive, good or bad.
> 5) Jobs posting is not allowed.
> 6) Sharing copyrighted material and their links is not allowed.
>
> NOTE : Don't ever post confidential data in a workbook. Forum owners and
> members are not responsible for any loss.
> ---
> You received this message because you are subscribed to the Google Groups
> "MS EXCEL AND VBA MACROS" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to excel-macros+unsubscr...@googlegroups.com.
> To post to this group, send email to excel-macros@googlegroups.com.
> Visit this group at http://groups.google.com/group/excel-macros?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
Thanks & Regards,
Gawli Anil Narayan
Software Developer,
Abacus Software Services Pvt Ltd

-- 
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.

NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Attachment: All India Party Master.xlsm
Description: Binary data

Reply via email to