+ Reply to Thread
Results 1 to 5 of 5

autofill a column alongside a range - how ?

  1. #1
    tonto57
    Guest

    autofill a column alongside a range - how ?

    I have a range established in columns G, H , I and J - a variable number of
    rows.

    I want to autofill columns A - F with a formula, but only for as many rows
    as exist at that time in the Range described above.

    Currnetly I have the formulas in the header row for columns A - F, so I can
    manually drag them down the corect number of rows each time. but can I
    automatate this in a VBA macro ?

    Suggestions Welcome.

  2. #2
    Stefi
    Guest

    RE: autofill a column alongside a range - how ?

    Sub autodrag()
    lastrow = ActiveSheet.Columns("G:J").Find(What:="*", _
    After:=Range("G1"), _
    LookAt:=xlPart, _
    LookIn:=xlValues, _
    SearchOrder:=xlByRows, _
    SearchDirection:=xlPrevious, _
    MatchCase:=False).Row
    Range("A1:F1").AutoFill Destination:=Range("A1:F" & lastrow),
    Type:=xlFillDefault
    End Sub

    Regards,
    Stefi


    „tonto57” ezt *rta:

    > I have a range established in columns G, H , I and J - a variable number of
    > rows.
    >
    > I want to autofill columns A - F with a formula, but only for as many rows
    > as exist at that time in the Range described above.
    >
    > Currnetly I have the formulas in the header row for columns A - F, so I can
    > manually drag them down the corect number of rows each time. but can I
    > automatate this in a VBA macro ?
    >
    > Suggestions Welcome.


  3. #3
    tonto57
    Guest

    RE: autofill a column alongside a range - how ?

    Thans Stefi, before I try that though - is there not a brackets mismatch on
    the lastrow assignment line ?

    "Stefi" wrote:

    > Sub autodrag()
    > lastrow = ActiveSheet.Columns("G:J").Find(What:="*", _
    > After:=Range("G1"), _
    > LookAt:=xlPart, _
    > LookIn:=xlValues, _
    > SearchOrder:=xlByRows, _
    > SearchDirection:=xlPrevious, _
    > MatchCase:=False).Row
    > Range("A1:F1").AutoFill Destination:=Range("A1:F" & lastrow),
    > Type:=xlFillDefault
    > End Sub
    >
    > Regards,
    > Stefi
    >
    >
    > „tonto57” ezt *rta:
    >
    > > I have a range established in columns G, H , I and J - a variable number of
    > > rows.
    > >
    > > I want to autofill columns A - F with a formula, but only for as many rows
    > > as exist at that time in the Range described above.
    > >
    > > Currnetly I have the formulas in the header row for columns A - F, so I can
    > > manually drag them down the corect number of rows each time. but can I
    > > automatate this in a VBA macro ?
    > >
    > > Suggestions Welcome.


  4. #4
    tonto57
    Guest

    RE: autofill a column alongside a range - how ?

    apologies - I see the bracket now

    "Stefi" wrote:

    > Sub autodrag()
    > lastrow = ActiveSheet.Columns("G:J").Find(What:="*", _
    > After:=Range("G1"), _
    > LookAt:=xlPart, _
    > LookIn:=xlValues, _
    > SearchOrder:=xlByRows, _
    > SearchDirection:=xlPrevious, _
    > MatchCase:=False).Row
    > Range("A1:F1").AutoFill Destination:=Range("A1:F" & lastrow),
    > Type:=xlFillDefault
    > End Sub
    >
    > Regards,
    > Stefi
    >
    >
    > „tonto57” ezt *rta:
    >
    > > I have a range established in columns G, H , I and J - a variable number of
    > > rows.
    > >
    > > I want to autofill columns A - F with a formula, but only for as many rows
    > > as exist at that time in the Range described above.
    > >
    > > Currnetly I have the formulas in the header row for columns A - F, so I can
    > > manually drag them down the corect number of rows each time. but can I
    > > automatate this in a VBA macro ?
    > >
    > > Suggestions Welcome.


  5. #5
    tonto57
    Guest

    RE: autofill a column alongside a range - how ?

    Spot On ! thank you Stefi.

    "Stefi" wrote:

    > Sub autodrag()
    > lastrow = ActiveSheet.Columns("G:J").Find(What:="*", _
    > After:=Range("G1"), _
    > LookAt:=xlPart, _
    > LookIn:=xlValues, _
    > SearchOrder:=xlByRows, _
    > SearchDirection:=xlPrevious, _
    > MatchCase:=False).Row
    > Range("A1:F1").AutoFill Destination:=Range("A1:F" & lastrow),
    > Type:=xlFillDefault
    > End Sub
    >
    > Regards,
    > Stefi
    >
    >
    > „tonto57” ezt *rta:
    >
    > > I have a range established in columns G, H , I and J - a variable number of
    > > rows.
    > >
    > > I want to autofill columns A - F with a formula, but only for as many rows
    > > as exist at that time in the Range described above.
    > >
    > > Currnetly I have the formulas in the header row for columns A - F, so I can
    > > manually drag them down the corect number of rows each time. but can I
    > > automatate this in a VBA macro ?
    > >
    > > Suggestions Welcome.


+ 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