Consulting

Results 1 to 4 of 4

Thread: Autofill column to last row

  1. #1

    Autofill column to last row

    Hi,

    I have recorded a macro, part of which includes inserting a line of text in the first cell of a column and then copying it down to correspond with the last row of text contained within other columns. So the code I have at the moment is as follows;

    HTML Code:
    ActiveCell.FormulaR1C1 = "Upcoming Releases"
        Range("I1").Select
        Selection.AutoFill Destination:=Range("I1:I200")
        Range("I1:I200").Select
    The problem is that the last row of text in the other columns is always different. How can I change the code so that it automatically fills to the last row?

    Thanks,
    Mark.

  2. #2
    VBAX Tutor
    Joined
    Jun 2012
    Posts
    269
    Location
    [VBA]
    ActiveCell.FormulaR1C1 = "Upcoming Releases"
    Range("I1").Select
    Selection.AutoFill Destination:=Range("I1:I" & activesheet.range("I65536").end(xlup).row)
    Range("I1:I"activesheet.range("I65536").end(xlup).row).Select
    selection.autofill destination:=range("I1:I" & activesheet.range("I65536").end(xlup).row)[/VBA]

  3. #3
    Thanks for your help. I'm getting a Compile Error: Syntax Error on this line.

    [vba]

    Range("I1:I"activesheet.range("I65536").end(xlup).row).Select
    [/vba]

  4. #4
    VBAX Tutor
    Joined
    Jun 2012
    Posts
    269
    Location
    Quote Originally Posted by hardcoremark
    Thanks for your help. I'm getting a Compile Error: Syntax Error on this line.

    [vba]

    Range("I1:I"activesheet.range("I65536").end(xlup).row).Select
    [/vba]
    Sorry in haste I forgot to put an ampersand.... that line should be:

    [VBA]Range("I1:I" & ActiveSheet.Range("I65536").End(xlUp).Row).Select[/VBA]

Posting Permissions

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