Solved

Save as VBA Excel

Posted on 2014-03-14
2
416 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 300 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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.
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…

739 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