Write in two ways to two different worksheets

  • All,


    I hope you can help me with this.


    I already have one part of the code ready, but i have to convert this part to also write in a different sheet and instead of horizontal it should be vertical


    Code
    Set wsAE = Worksheets("Sheet5")
    If MsgBox("Entrada correcta?", vbYesNo + vbQuestion, "Verificar los datos!") = vbNo Then Exit Sub
    iRow = wsAE.Cells.Find(What:="*", SearchOrder:=xlRows, SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1
    wsAE.Cells(iRow, 1).Resize(, 20).Value = Array(CMBCLIENT.Value, CMBPRESTADORA.Value, CMBDESPERSIONES.Value, CMBCONCEPTO.Value, CMBCOMISON.Value, cmbcosto.Value, CMBTIPO.Value, _
    CMBEMPRESA.Value, CMBIVA.Value, TXTIMPORTE.Value, TXTIMPORTEBRUTO.Value, TXTFECHA.Value, TXTSUMCOM.Value, TXTSUBTOTAL.Value, TXTSUMIVA.Value, TXTSUMFACT.Value, TXTPAGOCLIENTE.Value, _
    TXTREMANTE1.Value, TXTSUMCOSTO.Value, TXTREMANTE2.Value)

    I need to write this in a worksheet called AOM and the first empty cell is E7


    Can somebody kick me to the correct direction, cause it is driving me nuts X(

  • As a kick start, to write the array vertically...

    Code
    wsAE.Cells(iRow, 1).Resize(20).Value = Application.Transpose(Array(...)

    If I've been helpful, let me know. If I haven't, let me know that too. 

  • Heu everything.


    Maybe i have to aproach this different;


    How can i find and write into the next blank column, from a form in Excel.


    With this i can find the last column

    Code
    lastcol = Cells(1, Columns.Count).End(xlToLeft).Column

    But how can i address that:

    txt.value goes to E7

    txt2.value goes to E8

    etc


    And the next time it should go to

    txt.value goes to F7

    txt2.value goes to F8

    etc

  • Possibly...

    Code
    Dim lCol As Long
    With Worksheets("AOM")
    lCol = .Cells(7, .Columns.Count).End(xlToLeft).Column + 1
    wsAE.Cells(7, lCol).Resize(...
    End With

    If I've been helpful, let me know. If I haven't, let me know that too. 

  • So finaly i have it so far that i am writing in the correct order, but it does not goes to the new column.....


  • dangelor Thank you for the support, you pointed me to the correct direction!


    I mannaged to fix it


    So this one is solved!

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!