Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Save as VBA Excel

Posted on 2014-03-14
2
Medium Priority
?
426 Views
Last Modified: 2014-03-14
Hello,
Can you please help,
I'm trying to save the sheet (range) as a cell value.
but I keep getting error.

example,, Cell c2  is  
Orders Count_between (02/01/14 _ 02/28/14)

Sub Save_Operator()
    Sheets("Operator").Select
    Range("A1:G100").Select
    Selection.Copy
    Workbooks.Add
    ActiveSheet.Paste
    ActiveWorkbook.SaveAs Filename:= _
    "C:\Users\Wassim.\Desktop\" & Range("C1") & ."xlsx", FileFormat:=51, CreateBackup:=False
    ActiveWorkbook.Close
  MsgBox "Done"
End Sub

Thank you for your help,
0
Comment
Question by:W.E.B
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 34

Accepted Solution

by:
Norie earned 1200 total points
ID: 39930595
You'll need to replace the / in the dates.

This will replace them with -.
Sub Save_Operator()

    Sheets("Operator").Range("A1:G100").Copy
    Workbooks.Add (xlWBATWorksheet)
    ActiveSheet.Paste
    ActiveWorkbook.SaveAs _
        Filename:="C:\Users\Wassim.\Desktop\" & Replace(Range("C1"), "/", "-") & ".xlsx", FileFormat:=51
    ActiveWorkbook.Close

    MsgBox "Done"
    
End Sub

Open in new window

0
 

Author Closing Comment

by:W.E.B
ID: 39930609
Super,
thank you.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question