+ Reply to Thread
Results 1 to 2 of 2

Syntax problem with Autofill

Hybrid View

  1. #1
    Registered User
    Join Date
    07-16-2013
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    6

    Syntax problem with Autofill

    Hi everyone,

    I am having a bit of trouble converting code that was initially recorded a while back as a macro to executable code from a CommandButton_Click.

    It is trying to use autofill from cell A1 to Cell CV100 (a 100x100 grid). I am pretty sure I am missing something in the syntax needed for autofill, any help would be awesome! :D

    Original code:

    Range("A1").Select
    Selection.AutoFill Destination:=Range("A1:CV1"), Type:=xlFillDefault
    Range("A1:CV1").Select
    Selection.AutoFill Destination:=Range("A1:CV100"), Type:=xlFillDefault
    This is what I tried to do:

    ActiveWorkbook.Sheets("Graphing").Range("A1").AutoFill Destination:=Range("A1:CV1"), Type:=xlFillDefault
    ActiveWorkbook.Sheets("Graphing").Range("A1:CV100").AutoFill Destination:=Range("A1:CV100"), Type:=xlFillDefault

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Syntax problem with Autofill

    The second line is wrong, you are filling the same range, but the first line works.


    Sub test()
    
     With Sheets("Graphing")
    
       .Range("A1").AutoFill .Range("A1:CV1"), Type:=xlFillDefault
       .Range("A1:CV100").AutoFill .Range("A1:CV100"), Type:=xlFillDefault
     End With
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Autofill problem or is it not autofill?
    By Pat Feasey in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 02-14-2011, 02:21 PM
  2. [SOLVED] Syntax problem
    By ScottO in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-06-2005, 07:05 AM
  3. [SOLVED] Syntax problem
    By Alex H in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 02:05 AM
  4. Syntax problem
    By Alex H in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 01:05 AM
  5. Syntax problem
    By unknowndevice in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-26-2005, 06:05 PM

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