Results 1 to 3 of 3

VBA - "ActiveCell.Rows" command help

This is a discussion on VBA - "ActiveCell.Rows" command help within the Excel Questions forums, part of the Question Forums category; Hi, i'm attampting to insert a new row, where each time i insert the row, the row number will change. ...

  1. #1
    New Member
    Join Date
    Sep 2003
    Posts
    4

    Default VBA - "ActiveCell.Rows" command help

    Hi,

    i'm attampting to insert a new row, where each time i insert the row, the row number will change. Here is my current code: (note, the line i'm having trouble with is signified by *****)

    Cells.Find(What:="END OF RECORD", After:=ActiveCell, LookIn:=xlFormulas, _
    LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
    MatchCase:=False).Activate
    ActiveCell.Offset(-1, 0).Range("A1").Select
    ******Cells(ActiveCell.Row, 1).Select******
    Selection.Insert Shift:=xlDown
    ActiveCell.Offset(-2, 0).Range("A1").Select
    Selection.AutoFill Destination:=ActiveCell.Range("A1:A2"), Type:=xlFillDefault
    ActiveCell.Range("A1:A2").Select
    ActiveCell.Offset(1, 1).Range("A1").Select

  2. #2
    MrExcel MVP
    Join Date
    Mar 2002
    Location
    Michigan USA
    Posts
    11,454

    Default Re: VBA - "ActiveCell.Rows" command help

    Hi lancer:

    I did not quite follow your code -- however, in regard to inserting a row, how about ...
    Code:
    Selection.EntireRow.Insert
    this will insert a row above the selection
    Regards!

    Yogi Anand, D.Eng, P.E.
    Energy Efficient Building Network LLC
    www.energyefficientbuild.com

  3. #3
    New Member
    Join Date
    Sep 2003
    Posts
    4

    Default Re: VBA - "ActiveCell.Rows" command help

    Always the most straight forward solution.

    That worked wonderfully. Thanks a heap.

    Lancer.

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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


DMCA.com