Export to Excel

lsls Member Posts: 33
Hi,
I'm trying to create a cell in Excell which contains more cells, i.e.: a cell that is the union of A1+B1+A2+B2.
Is there anyone who can help me, please?

Thanx
ls

Comments

  • mohana_cse06mohana_cse06 Member Posts: 5,504
    calculate the values in navision and push it into the single cell.

    later push the individual values to the cells.
  • lsls Member Posts: 33
    Maybe I didn't explain the problem: I don't need to do the sum of the value, but a cell that is large like a1+b1+a2+b2 with excel union. After, I should put different values in A3, B3, etc.

    Thanx
    ls
  • SogSog Member Posts: 1,023
    You open excel, select the cells you want to merge and press on the merge cell button. (Don't have english excel, so it might be union instead of merge)
    That is the response to your question if you don't give more information as in "from NAV" or Automation or something similar.
    Please ask questions so that people understand exactly what you mean.
    (while writing this down you've explained it a bit further)

    Anyway, the function of the excel automation you seek is range. and the child-function merge.
    The range function has 2 parameters: Cell 1 and 2. Ranges are always a square. So Cell 1 would be A1 and cell 2 would be B2. Effectively having a range A1 A2 B1 B2.
    Next call the function range.merge and you have your cells merged.
    I've got no code examples for this. But the excel buffer might use range.
    |Pressing F1 is so much faster than opening your browser|
    |To-Increase|
  • lsls Member Posts: 33
    Sog wrote:
    You open excel, select the cells you want to merge and press on the merge cell button. (Don't have english excel, so it might be union instead of merge)
    This is the operation I should make, but in NAV.
    I wrote
    XlWS.Range('A1','b2' ).Value := ("G/L Account"."No.");
    but in this way I see the value in 4 cells (A1,B1,A2,B2) and not a big cell with this value, as I should have.
    Any idea?

    Thanx
    ls
  • IsakssonMiIsakssonMi Member Posts: 77
    Record a macro while doing it in Excel, then look at the generated code and do the same in NAV with the automations.
  • SogSog Member Posts: 1,023
    Could it be something like
    xlws.range('A1','B2').merge;
    XlWS.Range('A1','B2').Value := ("G/L Account"."No.");

    or
    xlws.range('A1').value := "G/L Account"."No.");
    xlws.range('A1','B2').merge;
    |Pressing F1 is so much faster than opening your browser|
    |To-Increase|
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    Try this.
    xlWorkSheet.Range('A1','B1').mergecells;
  • vaprogvaprog Member Posts: 1,139
    To answer questions like this for yourself, record a macro in excel doing whatever you need. Then look at the genereted VBA-Code and reimplement it in C/AL.
  • lsls Member Posts: 33
    Sog wrote:
    Could it be something like
    xlws.range('A1','B2').merge;
    XlWS.Range('A1','B2').Value := ("G/L Account"."No.");

    or
    xlws.range('A1').value := "G/L Account"."No.");
    xlws.range('A1','B2').merge;

    It works! =D> =D> =D>

    Thanx

    ls
Sign In or Register to comment.