SuraDalbin
asked on
Excel Import/Export Named Ranges and Values
Hello Experts,
In the attached file, I have the following code that exports up to 20 named ranges and their corresponding cell values to a Text file and it lists all in separate rows. See result in data file Data.txt:
My question is in two parts:
The rationale of exporting the named range values into a text file and then importing to a separate file is for separation of duties between departments. I'm using Excel 2013 and Windows 7.
Any help with this will be greatly appreciated.
Thank you,
Sura
WriteToTextFile.xlsm
In the attached file, I have the following code that exports up to 20 named ranges and their corresponding cell values to a Text file and it lists all in separate rows. See result in data file Data.txt:
Sub WriteToTextFile()
Dim c As Range, r As Range
Dim output As String
For Each r In Worksheets("EXPORT").Range("Date, Employee, ProspectClientExisting, EstimatedRevenue, Partner, Manager, BillingManager, ClientName, Address, Address2, Address3, City, State, Zip, Country, ContactName, ContactEmail, ContactTelephone, ContactTelephone2, ContactFax, Attention, Invoice").Rows
For Each c In r.Cells
output = output & c.Name.Name & "," & c.Value & ","
Next c
output = output & vbNewLine
Next r
Open "C:\Code Test\Data.txt" For Output As #1
Print #1, output
Close
End Sub
My question is in two parts:
- I would like to be able to export all named ranges and their corresponding values to a text file, which can go up to 100 names
- The named range values from the text file will then need to be imported into a separate Excel file, which has the same named ranges
The rationale of exporting the named range values into a text file and then importing to a separate file is for separation of duties between departments. I'm using Excel 2013 and Windows 7.
Any help with this will be greatly appreciated.
Thank you,
Sura
WriteToTextFile.xlsm
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ryan, thank you for your help.
Gowflow, your solution works perfectly. Thank you very much!
Gowflow, your solution works perfectly. Thank you very much!
Your most welcome.
gowflow
gowflow
a quick approach:
Open in new window
for part 2, it could be a bit more complicated.