Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2005
    Posts
    183

    Arrow Unanswered: insert rows in Excel via Access

    Below is piece of a procedure in an Access database, that uses a recordset to feed data into an Excel sheet.

    The problem is, that after the points fields has been filled out (column 4 in the spreadsheet) I need Access to go to the line below it, and insert a row, pusing whatever is below it, downwards (similar to "Insert Shift:=xlDown" when coding Excel spreadsheets).

    How do I do that in Access?

    Thanks in advance.

    /Trin

    Code:
    With objActiveWkb
    .Worksheets(6).Cells(fordarktal, 1) = kunst_udvalg!Medlemsnummer
    .Worksheets(6).Cells(fordarktal, 3) = kunst_udvalg!Medlemsnavn
    .Worksheets(6).Cells(fordarktal, 4) = kunst_udvalg!Points
    End With
    kunst_udvalg.MoveNext
    fordarktal = fordarktal + 1
    IT squid: networks, servers, firewalls, routers and I dabble a little with SQL-server and Access as well....

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Check out this post:
    http://www.dbforums.com/showthread.php?t=1208155

    In particualr you are interested in the CopyFromRecordset method. Much more efficient than writing cell by cell if you are looking for a "table" of data

    HTH
    Testimonial:
    pootle flump
    ur codings are working excelent.

  3. #3
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Just reread. There is something in the sheet below that you want to remain...

    Loop use an iterant to insert one row per recordset record then CopyFromRecordset?

    Code:
    For i = 0 To rs.RecordCount - 1
     
        exSheet.Rows(3).Insert xlDown
     
    Next i
    Testimonial:
    pootle flump
    ur codings are working excelent.

Posting Permissions

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