Results 1 to 6 of 6

Correct sytax for using a range n VBA

Threaded View

  1. #1
    Forum Contributor
    Join Date
    12-02-2008
    Location
    Brisbane
    MS-Off Ver
    2016
    Posts
    807

    Correct sytax for using a range n VBA

    I am trying to check if a folder exits, and if not, create it (folder name is WOD). I am then trying to save the file as the contents of a cell which is found on a different sheet from where the macro is run, the sheet being Multiple and the cell being G9. The code falls over at the Range("Multiple!G9") part so I obviously have the syntax wrong but I am not sure what it should be. Help please!


    Sub Saveworksheet()
    
    If Len(Dir("c:\WOD", vbDirectory)) = 0 Then
        MkDir "c:\WOD"
    End If
    Application.DisplayAlerts = False
    ActiveWorkbook.SaveAs Filename:="C:\WOD\" & Range("Multiple!G9"), _
    FileFormat:=(.xlsm), _
    CreateBackup:=False
    Application.DisplayAlerts = True
    ActiveWorkbook.Close SaveChanges:=False
    
    End Sub
    Last edited by BRISBANEBOB; 11-14-2013 at 09:12 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Range Address Is Correct Columns Count Is Not Correct
    By goss in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-09-2013, 12:47 PM
  2. [SOLVED] long line in the macro code giving sytax error
    By hnpsingh in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-28-2012, 12:46 PM
  3. Trying to select a range prior to deleting it so i can verify correct range removed
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-13-2011, 08:59 PM
  4. sytax to select next row
    By artromanov in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-26-2007, 10:00 PM
  5. Replies: 2
    Last Post: 04-01-2006, 02:15 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1