Ready to Use 101 Powerful MS Excel VBA Code: Increase Your Excel Productivity 10x by Anil Nahar

Ready to Use 101 Powerful MS Excel VBA Code: Increase Your Excel Productivity 10x by Anil Nahar

Author:Anil Nahar
Language: eng
Format: azw3
Tags: Non-Fiction, Computers, Programming, Spreadsheets, Desktop Applications, Computer Engineering, Microsoft
ISBN: 9781973519478
Publisher: Amazon Digital Services LLC - Kdp Print Us
Published: 2017-12-15T00:00:00+00:00


Import Multiple Text Files

Sub MulipleTextFiles()

'SmartCode for Insert Multiple text file in Seoarate worksheets

'SmartExcel(www.anilnahar.com)

Dim xFilesToOpen As Variant

Dim I As Integer

Dim xWb As Workbook

Dim xTempWb As Workbook

Dim xDelimiter As String

Dim xScreen As Boolean

On Error GoTo ErrHandler

xScreen = Application.ScreenUpdating

Application.ScreenUpdating = False

xDelimiter = "|"

xFilesToOpen = Application.GetOpenFilename("Text Files (*.txt), *.txt", , "Smart Excel", , True)

If TypeName(xFilesToOpen) = "Boolean" Then

MsgBox "No files were selected", , "Smart Excel"

GoTo ExitHandler

End If

I = 1

Set xTempWb = Workbooks.Open(xFilesToOpen(I))

xTempWb.Sheets(1).Copy

Set xWb = Application.ActiveWorkbook

xTempWb.Close False

xWb.Worksheets(I).Columns("A:A").TextToColumns _

Destination:=Range("A1"), DataType:=xlDelimited, _

TextQualifier:=xlDoubleQuote, _

ConsecutiveDelimiter:=False, _

Tab:=False, Semicolon:=False, _

Comma:=False, Space:=False, _

Other:=True, OtherChar:="|"

Do While I < UBound(xFilesToOpen)

I = I + 1

Set xTempWb = Workbooks.Open(xFilesToOpen(I))

With xWb

xTempWb.Sheets(1).Move after:=.Sheets(.Sheets.Count)

.Worksheets(I).Columns("A:A").TextToColumns _

Destination:=Range("A1"), DataType:=xlDelimited, _

TextQualifier:=xlDoubleQuote, _

ConsecutiveDelimiter:=False, _

Tab:=False, Semicolon:=False, _

Comma:=False, Space:=False, _

Other:=True, OtherChar:=xDelimiter

End With

Loop

ExitHandler:

Application.ScreenUpdating = xScreen

Set xWb = Nothing

Set xTempWb = Nothing

Exit Sub

ErrHandler:

MsgBox Err.Description, , "SmartExcel(www.anilnahar.com)"

Resume ExitHandler

End Sub



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Popular ebooks
Salesforce Platform App Builder Certification Guide by Paul Goodey(1884)
Salesforce Advanced Administrator Certification Guide by Enrico Murru(1447)
Microsoft Power Platform Functional Consultant: PL-200 Exam Guide by Julian Sharp(1257)
Implementing Microsoft SharePoint 2019 by Lewin Wanzer and Angel Wood(1225)
Office 365 User Guide by Nikkia Carter(1160)
Scrivener for Dummies by Gwen Hernandez(564)
Advanced Excel Success by Alan Murray(541)
Automated Data Analysis Using Excel by Bissett Brian D.;(537)
Personal Finance in Your 20s & 30s For Dummies by Eric Tyson(513)
EXCEL 2021: Learn Excel Essentials Skill with Practical Exercises for Dummies by STRATVERT KEVIN(493)
Excel Dashboards and Reports for Dummies by Michael Alexander(484)
Excel 2019 All-In-One for Dummies by Harvey Greg;(477)
Basic SPSS Tutorial by Manfred te Grotenhuis & Anneke Matthijssen(470)
Tableau Desktop 10: Get up and running in a blaze with visual modular examples! by Jaxily(466)
Excel Bible for Beginners: Excel for Dummies Book Containing the Most Awesome Ready to use Excel VBA Macros by Suman Harjit(457)
Dashboarding and Reporting with Power Pivot and Excel: How to Design and Create a Financial Dashboard with PowerPivot – End to End by Kasper de Jonge(451)
Dashboarding and Reporting with Power Pivot and Excel by de Jonge Kasper(449)
Microsoft Office Access 2007 Step by Step by Steve Lambert & M. Lambert & Joan Lambert(447)
Excel 2007 Dashboards & Reports For Dummies by Michael Alexander(403)
Excel Bible for Beginners: Excel for Dummies Guide to the Best Excel Tools, Tips and Shortcuts you Must Know by Suman Harjit(401)