2016年2月24日星期三

How to Fix - Trying to give good header?

Trying to give good header

Hi, I am using below code for importing all multiple files data into maser sheet.

It is only importing excel files in a folder.

What I want is, import all data excel format and csv format file also.

Can you help on this?

Below is the code I am using.

Private Sub CommandButton3_Click()
Dim strPath As String
    Dim strFile As String
    Dim wbkSrc As Workbook
    Dim wshSrc As Worksheet
    Dim wshTrg As Worksheet
    With Application.FileDialog(4) ' msoFileDialogFolderPicker
    
     MsgBox "All existing data will be cleared" ' for exixting data cleared
    Range("a2:t65536").Select
    Range("a2:t65536").Clear
    
        If .Show Then
            strPath = .SelectedItems(1)
        Else
            MsgBox "You didn't select a folder", vbExclamation
            Exit Sub
        End If
    End With
    Application.ScreenUpdating = False
    If Right(strPath, 1) <> "\" Then
        strPath = strPath & "\"
    End If
    Set wshTrg = ActiveSheet
    strFile = Dir(strPath & "*.xls*")
   
    Do While strFile <> ""
        Set wbkSrc = Workbooks.Open(strPath & strFile)
        Set wshSrc = wbkSrc.Worksheets(1)
        wshSrc.Range("A2:T65536").Copy
        wshTrg.Range("A" & wshTrg.Rows.Count).End(xlUp) _
            .Offset(1, 0).PasteSpecial xlPasteValues

        Application.CutCopyMode = False
        wbkSrc.Close SaveChanges:=False
        strFile = Dir
    Loop
    Application.ScreenUpdating = True

    MsgBox "Data Import successful"
    End Sub
Thanks,
Chandru

Anwsers to the Problem Trying to give good header

Download Error Fixer for Free Now

You need to not copy the header, so change

       Else
            'wshSrc.Range("A2:T" & wshSrc.Cells(wshSrc.Rows.Count, "T").End(xlUp)).Copy
            wshSrc.Range("A1").CurrentRegion.Copy
        End If

to

         Else
            'wshSrc.Range("A2:T" & wshSrc.Cells(wshSrc.Rows.Count, "T").End(xlUp)).Copy
            wshSrc.Range("A1").CurrentRegion.Offset(1,0).Copy
        End If

If you failed to fix it, another option is to call Microsoft and walk through the process with a technician. To do this, dial "1-800-936-5700". Explain the error that you received and the steps in the update process during which it was displayed. The technician will be able to walk through the steps from getting a new product key to finishing the installation.

Another Safe way to Repair the Problem: Trying to give good header:

 

 

How to Fix Trying to give good header with SmartPCFixer?

1. You can Download SmartPCFixer here. Install it on your computer. When you open it, it will perform a scan.

2. After the scan is done, you can see the errors and problems need to be fixed. Click Fix All.

3. When the Fixing part is finished, your computer has been speeded up and the errors have been removed


Related: Babylon dictionary doesn t pop up when I use its activation hotkey on a text in Windows environment realtek drivers download Does a Windows 7 Installer Cleanup Utility exist realtek audio driver windows 7 I have multiple updates eleven that will not install on Windows 7 Pro This has been an issue for many months Please help realtek audio driver windows 7 Printing messages on Windows Mail realtek drivers download Sporadic Windows Explorer has stopped working even after hot fixes and repair install realtek driver Windows 7 won t load to login screen it keeps loading starting windows fixed realtek audio driver download Windows Server 2003 64bit Terminal Server has 2 mouse pointers when connecting via RDP realtek audio drivers three Scroll as a result of the record of hardware set up until you come across “Enhanced Display” listed.,Office 2103 - Word Works, Excel Won't Even Load.,Start Excel In Fullscreen Mode,Cannot Connect To Home Network After Connecting To Internet At Duke University,Error Code 1402 : HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\OptionalComponents\MSFS,Windows Update Install Error Code 8007371C
Read More: [Solution] I am having a system image back-up problem. Every,Windows will not close when I try shutdown, it appears to hang ? [Solved],[Solved] i want to watch a video of my family on facebook but it says i must get adobe media player installed so how do i do this?,Troubleshooter of Error: my ' turns windows featuire on or off ' this box remains empty..,How Can I Fix - windows 8.1 won't log in in the morning?,Screen flickers while browsing. __,Want to stop Word from asking me if I want to merge documents(Office),Qualcom Atheros,Windows 7 - Black Screen,IE 8 on windows 7 or 8? I need it to access business portals that do not support 9 or higher

没有评论:

发表评论

注意:只有此博客的成员才能发布评论。