Ask Experts Questions for FREE Help !
Ask
    kvinay_00's Avatar
    kvinay_00 Posts: 36, Reputation: 1
    Junior Member
     
    #1

    Apr 27, 2012, 05:24 AM
    Export one sheet from a workbook
    Hello,

    I have a working workbook with many linked sheets and formulas.

    I want to export one sheet out of this (named "1") and save in new workbook without formula (i.e. save as value) and the name of the new workbook should be picked from a cell value (AD1).

    Can any one help please with suitable macro?

    Thanks in advance.
    JBeaucaire's Avatar
    JBeaucaire Posts: 5,426, Reputation: 997
    Software Expert
     
    #2

    Apr 27, 2012, 11:27 PM
    Something like this... you'll most likely have to play with the SaveAs command to get it working in your environment:
    Code:
    Option Explicit
    
    Sub ExportSheet()
    Dim Savepath As String
    
    Savepath = "C:\Path\To\Save\Files\"    'remember the final \ in this string
    
    With Sheets("1")
        .UsedRange.Copy
        Sheets.Add
        Range("A1").PasteSpecial xlPasteAll, xlPasteValues
        Sheets.Move
        ActiveWorkbook.SaveAs Range("AD1").Value & ".xlsx", xlNormal
        ActiveWorkbook.Close
    End With
    
    End Sub
    kvinay_00's Avatar
    kvinay_00 Posts: 36, Reputation: 1
    Junior Member
     
    #3

    Apr 29, 2012, 05:02 AM
    Thanks JBeaucaire.

    I have attached the sample file which already has some codes, can you look into and help me?

    Thanks
    Attached Files
  1. File Type: xls Form 2012.xls (87.0 KB, 121 views)
  2. kvinay_00's Avatar
    kvinay_00 Posts: 36, Reputation: 1
    Junior Member
     
    #4

    May 1, 2012, 05:56 AM
    The first file attached was locked for seeing vba codes, revised file attached, please refer that.

    Sorry for the inconvenience.


    Thanks
    Attached Files
  3. File Type: xls Form 2012 no pwd.xls (91.0 KB, 126 views)
  4. JBeaucaire's Avatar
    JBeaucaire Posts: 5,426, Reputation: 997
    Software Expert
     
    #5

    May 1, 2012, 11:59 AM
    Then you only need to change one little thing:

    Code:
    ActiveWorkbook.SaveAs Range("AD1").Value & ".xls", xlNormal


    Also, you can shorten up your CleanAll macro to:

    Code:
    Sub CleanAll()
       Range("K1:N1,R1:U1,X1:AB1,J2:M4,P2:Q4,U2:W2,AA2:AB2,U3:V6,C5:G6,J5:Q6,W4:AB6,A8:AB10,A12:AB16,B21:F40,Q21:S40,B43:k52,B56:K61,B65:K68,A71:AB71,A73:AB73").ClearContents
    End Sub

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

Linking All Sheets in Workbook to 1 Sheet [ 1 Answers ]

I have an excel workbook with multiple sheets. My first sheet is a hyperlink list to all the different sheets. I would like to have a hyperlink in each sheet back to the list sheet. Is there a formula or simple way to do this without going to each sheet and manually doing it? I am thinking cell A1...

How I Can make an index sheet which has links to all other sheets in the workbook? [ 2 Answers ]

I want to the other sheet to look like an hyperlinks in the first sheet !

Link spread sheets sheet 1 to sheet 2 , 2 to sheet 3 [ 4 Answers ]

I have attach what I have done on the site. What I need to do is link all of the data from sheet one to sheet 2. All I have found so far is how to link one cell to the other cell. In sheet 1 I have af 3 to af 699 . I need to bring all that data to sheet 2 to (d3 to d24) Sheet 2 will link into...

XL only opens with sheet not workbook [ 1 Answers ]

All XL workbooks formerly saved only open in sheet format. When documents are copied and taken to another computer, all sheets of workbook are there. How can this be converted back to opening as a workbook?

Worksheets within the same workbook [ 21 Answers ]

Hi, I have many worksheets within the same file, what I really want is to have either a (link / go to option) from sheet1 to other sheets without using hyperlink because I want to send to others. Example: if I click on Apple from Sheet 1, I will go to Sheet2 Sheet1 Sheet2 ...


View more questions Search