+ Reply to Thread
Results 1 to 5 of 5

VB range

  1. #1
    Registered User
    Join Date
    08-09-2006
    Posts
    30

    VB range

    This is the line of code that gives me trouble:

    Range("G9").Select
    Selection.AutoFill Destination:=Range("G9:G500"), Type:=xlFillDefault

    I am trying to fill the range G9:G500, however, G500 is a length determined by the value of cell A1 (Eg: right now Cell A1 is 500) How would i tell the Macro to fill from G9 to "Value of A1" ?

    Thanks

  2. #2
    Forum Contributor
    Join Date
    03-15-2005
    Location
    North Carolina
    MS-Off Ver
    2003 & 2007
    Posts
    180
    Try this

    Selection.AutoFill Destination:=Range("G9:G" & Range("A1").value), Type:=xlFillDefault

    HTH

    Jason

  3. #3
    Registered User
    Join Date
    08-09-2006
    Posts
    30
    Method 'Range' of Object ' _global' Failed

  4. #4
    Forum Contributor
    Join Date
    03-15-2005
    Location
    North Carolina
    MS-Off Ver
    2003 & 2007
    Posts
    180
    My understanding is that A1 has the end row number in it. Like row 500 in your example. Or do you have G500 there? This was setup to have only the end row number.

    Also make sure you selected G9 first. If you do have G500 in A1 use this

    Range("G9").AutoFill Destination:=Range("G9:" & Range("A1").value), Type:=xlFillDefault

  5. #5
    Registered User
    Join Date
    08-09-2006
    Posts
    30
    aha, that worked, error was in the data storage type, thanks a bunch for the help! saved me much frustration

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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