+ Reply to Thread
Results 1 to 2 of 2

xfert an access table into an excel file and format

  1. #1
    Registered User
    Join Date
    09-01-2013
    Location
    france
    MS-Off Ver
    Excel 2010
    Posts
    2

    xfert an access table into an excel file and format

    Hello,
    I am a French developer with access and excel.
    my job today is to format an excel file through an access application.
    The mistake today is how I can sort my data when the number of rows is different each time , my file is a result and I have to give it in excel format.
    here is my mistake

    aaa = ActiveSheet.UsedRange.Rows.Count + ActiveSheet.UsedRange.Row - 1
    bb = "B2,H" & aaa
    aa = "A2,H" & aaa
    ActiveWorkbook.Worksheets("transfert_compta").Sort.SortFields.Clear
    ActiveWorkbook.Worksheets("transfert_compta").Sort.SortFields.Add Key:=Range(bb), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
    With ActiveWorkbook.Worksheets("transfert_compta").Sort
    .SetRange Range(aa)
    .Header = xlGuess
    .MatchCase = False
    .Orientation = xlTopToBottom
    .SortMethod = xlPinYin
    .Apply
    End With
    Thank you for the answer
    Daniel

  2. #2
    Registered User
    Join Date
    09-01-2013
    Location
    france
    MS-Off Ver
    Excel 2010
    Posts
    2

    Lightbulb Re: xfert an access table into an excel file and format

    Hello,
    I've got a solution to my deal,
    here it is

    'cellule de départ de tri
    .Range("a2").Select
    aa = .ActiveCell.Address
    'cellule de fin de tri
    .Range("h2").Select
    .Selection.End(xlDown).Select
    bb = .ActiveCell.Address
    ' .Range (bb)
    .Selection.End(xlDown).Select
    bb = .ActiveCell.Address
    ' cellule 1 de colonne de tri
    .Range("b2").Select
    trd = .ActiveCell.Address
    ' cellule fin de colonne de tri
    .Selection.End(xlDown).Select
    trf = .ActiveCell.Address



    .ActiveWorkbook.Worksheets("transfert_compta").Sort.SortFields.Clear
    .ActiveWorkbook.Worksheets("transfert_compta").Sort.SortFields.Add Key:=Range(trd & ":" & trf), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
    With ActiveWorkbook.Worksheets("transfert_compta").Sort
    .SetRange Range(aa & ":" & bb)
    .Header = xlGuess
    .MatchCase = False
    .Orientation = xlTopToBottom
    .SortMethod = xlPinYin
    .Apply
    End With
    ' Sauvegarder et fermer le classeur
    ActiveWorkbook.Save
    .Quit
    friendly
    Daniel

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Import Text File to Access Table using Excel VBA
    By curiosity1990 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-07-2013, 09:43 AM
  2. Saved file from Excel 2000 to 2010 format and lost some Macro access
    By JO505 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-26-2013, 11:48 AM
  3. [SOLVED] Upload data from excel file to access table using vba
    By aman1234 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 08-23-2012, 08:31 AM
  4. Copy Excel to Text file and pass Text file to Access Table
    By robbie_xcell in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-27-2011, 01:53 PM
  5. Replies: 2
    Last Post: 04-30-2005, 07:06 PM

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