Consulting

Results 1 to 6 of 6

Thread: stupid questions

  1. #1
    VBAX Contributor
    Joined
    Jun 2008
    Posts
    169
    Location

    stupid questions

    Hi

    I have stupid questions as I?m not familiars excel,

    May I know if formulas can set up 5 rows to go?

    Since I have the data have too many row at the COL ?A,
    A1 = A/C numers
    A2 = products code
    A3 = address
    A4 = partnership name
    A5 = volumes

    At the COL D can I just drag the cells to down that?s can just returns the A/C numbers.

    Sample:

    Range D1 = A1
    D2 = A6
    D3 = A11 ?


    does it be formulas support ?



    Thanks very much

  2. #2
    VBAX Expert
    Joined
    Feb 2005
    Location
    Nanaimo, British Columbia, Cananda
    Posts
    568
    Location
    Hi kk,

    I don't know of any way to do that with a formula. It could be done with VBA...

    In your workbook:

    - Press <ALT+F11>

    - Use Insert/Module in the window that opens

    - Copy and paste the code into that 'Module'

    - File/Close and Return to Excel

    - Save the file

    - Press <Alt+F8> to get a list of Macros

    - Choose "FillD" and click Run






    [VBA]
    Option Explicit
    Sub FillD()
    Dim i As Long
    Dim dRow As Long
    Dim gRow As Long
    Dim countr As Long
    Dim LastRow As Long
    ' Get last row of data ColUmn A
    LastRow = Range("a65536").End(xlUp).Row

    ' Define loop
    LastRow = (LastRow / 5) + 1

    ' Start in row 1
    dRow = 1
    gRow = 1

    ' Do all
    For i = 1 To LastRow
    Cells(dRow, "D") = "=A" & gRow
    ' Increment destination row
    dRow = dRow + 1
    ' Increment get row
    gRow = gRow + 5
    Next i
    End Sub

    [/VBA]
    Cheers,

    dr

    "Questions, help and advice for free, small projects by donation. large projects by quote"

    http:\\www.ExcelVBA.joellerabu.com

  3. #3
    VBAX Contributor
    Joined
    Jun 2008
    Posts
    169
    Location
    Wow, that?s very great,
    Thank you very much your help

    Actually My row start from A10 to last row,

    How can it to modify your code

    Pleased

  4. #4
    VBAX Contributor
    Joined
    Jun 2008
    Posts
    169
    Location
    Dear rbrhodes

    I get understanding, Grow=5 that's ok

    Thanks very much
    Thanks
    thanks

  5. #5
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    D1: =INDEX(A:A,(ROW(A1)-1)*5+1)

    and copy down
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  6. #6
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Quote Originally Posted by rbrhodes
    [VBA]

    For i = 1 To LastRow
    Cells(dRow, "D") = "=A" & gRow
    ' Increment destination row
    dRow = dRow + 1
    ' Increment get row
    gRow = gRow + 5
    Next i
    End Sub

    [/VBA]
    Simpler

    [vba]

    For i = 1 To LastRow
    Cells(i, "D") = "=A" & (i - 1) * 5 + 1
    Next i
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

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