View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
David David is offline
external usenet poster
 
Posts: 153
Default Automatic Sheet Name Read and Rename

Add these two lines of code to your macro right after opening the .csv file in you code.

****Assuming the file opens with only one tab****
activeTab = ActiveSheet.Name
Sheets(activeTab).Name = "Data"





----- DataMan wrote: -----

I need to know if there is a way to write a macro or the code that will
open a file with the one worksheet that has a variable name and rename
it to "Data".

A program we pull trends with creates a .csv file with the worksheet
that has the same name as the file name. I am trying to create a macro
that will chart the data in the file. I want to be able to share this
and would like to not have to constrict file names to match a
referenced sheet name in a macro. I would rather rename the sheet when
the file opens to match my referenced sheet name in my macro.

Can this be done? Please answer this one. The last message I submitted
has never been answered. That was over 2 months ago. Nobody would find
it now.


---
Message posted from http://www.ExcelForum.com/