Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Excel Cell Copy - Update Formulas

Excel Cell Copy - Update Formulas

Scheduled Pinned Locked Moved C#
questiondata-structureshelpannouncement
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gmhanna
    wrote on last edited by
    #1

    Hi, I'm trying to copy from lets say column "AC" to column "AA". The cell contains a formula which I have gotten and built an array out of the spreadsheet. Where I am stuck is how do you get the formula to update. IE: If the formula was =ROUND(AC25) when I copy it programatically to column AA, it still says =ROUND(AC25) instead of =ROUND(AA25). I know I can use the replace command and do a string replacement, however if the formula is: =ROUND(A5+AB5) and is in column C, when I try to replace the A to a C, it becomes =ROUND(C5+CB5) instead of =ROUND(C5+AB5). So my question is there a built in method into the Excel that I can call to perform the cell copy updating the formulas such as Excel does when you do it by hand? Thank you,

    Glenn

    D 1 Reply Last reply
    0
    • G gmhanna

      Hi, I'm trying to copy from lets say column "AC" to column "AA". The cell contains a formula which I have gotten and built an array out of the spreadsheet. Where I am stuck is how do you get the formula to update. IE: If the formula was =ROUND(AC25) when I copy it programatically to column AA, it still says =ROUND(AC25) instead of =ROUND(AA25). I know I can use the replace command and do a string replacement, however if the formula is: =ROUND(A5+AB5) and is in column C, when I try to replace the A to a C, it becomes =ROUND(C5+CB5) instead of =ROUND(C5+AB5). So my question is there a built in method into the Excel that I can call to perform the cell copy updating the formulas such as Excel does when you do it by hand? Thank you,

      Glenn

      D Offline
      D Offline
      Dan Mos
      wrote on last edited by
      #2

      Hello Glenn, Not sure if it will help, but most of the Excel problems I had, I solved by recording a macro while doing it in excel, and then just transalte/adapt VBA to C#/Excel interop. Worked like a charm. It should work in your case too. :)

      All the best, Dan

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups