Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

Export to excel i autofill

[es] :: Access :: Export to excel i autofill

[ Pregleda: 2229 | Odgovora: 0 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

sdds
beograd

Član broj: 155074
Poruke: 27
*.eunet.rs.



Profil

icon Export to excel i autofill10.03.2009. u 10:10 - pre 184 meseci
Imam kod kojim unosim formulu u odredjena polja u excelu.


Code:
Public Sub ModifyExportedExcelFileFormats(sFile As String)
On Error GoTo Err_ModifyExportedExcelFileFormats

    Application.SetOption "Show Status Bar", True

    vStatusBar = SysCmd(acSysCmdSetStatus, "Formatting export file... please wait.")
    Dim lastrow As Long
    Dim xlApp As Object
    Dim xlSheet As Object
    



    Set xlApp = CreateObject("Excel.Application")
    Set xlSheet = xlApp.Workbooks.Open(sFile).Sheets(1)
    
    With xlApp
            .Application.Sheets("bbb").Select
            .Application.Cells.Select
            .Application.Selection.ClearFormats
            .Application.Cells.Select
            .Application.Selection.RowHeight = 12.75
            .Application.Selection.Columns.AutoFit
           
           .Application.Range("I2").Select
           .Application.ActiveCell.FormulaR1C1 = "=(IF(RC[-3]=0,RC[-1]*RC[4],0)"
           .Application.Selection.AutoFill Destination:=.Application.Range("I2:I2500")
            
                                  
            .Application.Activeworkbook.Save
            .Application.Activeworkbook.Close
            .Quit
    End With

    Set xlApp = Nothing
    Set xlSheet = Nothing

    vStatusBar = SysCmd(acSysCmdClearStatus)

Exit_ModifyExportedExcelFileFormats:
    Exit Sub

Err_ModifyExportedExcelFileFormats:
    vStatusBar = SysCmd(acSysCmdClearStatus)
    MsgBox Err.Number & " - " & Err.Description
    Resume Exit_ModifyExportedExcelFileFormats
End Sub


Kako da podesim autofill da unosi formulu dok ima podataka u koloni/
Pokusao sam nesto ovako ali izbacuje poruku "1004 application-defined or object-defined error"

Code:
.Application.Selection.AutoFill Destination:=.Application.Range("I2:I" & .Application.Range("D2").End(xlDown).Row)


[Ovu poruku je menjao sdds dana 10.03.2009. u 12:09 GMT+1]
 
Odgovor na temu

[es] :: Access :: Export to excel i autofill

[ Pregleda: 2229 | Odgovora: 0 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.