• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Compile all data from only visible worksheets of a workbook to another.

Hi SM & NK sir,

Please see the vba coding and please help me out because it not working whatever exactly i want. there are some hidden and filtered worksheet but i want compile data from only all visible worksheets.

Code:
Option Explicit
Sub Get_Data()
Dim sh As Worksheet
Dim sw As Workbook
Dim dw As Worksheet


Application.ScreenUpdating = False

Set sh = Sheet25 ' Data
sh.Range("A3:AB" & Rows.Count).ClearContents

Set sw = Workbooks.Open("C:\Documents and Settings\ramesh\Desktop\Tracker Sheet- CRM.xlsx")

For Each dw In sw.Worksheets
If dw.Visible <> xlVeryHidden Then

    dw.Range("A2", dw.Range("AB" & Rows.Count).End(xlUp)).Copy sh.Range("A" & Rows.Count).End(xlUp)(2)
    End If
    Next dw
    sw.Close False
    Application.ScreenUpdating = True

End Sub
 
Last edited by a moderator:
Back
Top