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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. merging cells to perform calculations in escel visual basic

merging cells to perform calculations in escel visual basic

Scheduled Pinned Locked Moved Visual Basic
toolstutorialquestionannouncement
1 Posts 1 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.
  • M Offline
    M Offline
    Matthew Leggett
    wrote on last edited by
    #1

    Hi I have the following script Dim DStartR As String Dim DStartC As String Dim DEndR As String Dim DEndC As String Dim StartLocation As String Dim EndLocation As String Worksheets(SetMonth).Range("D5").Select DStartR = "=Cell(""row"",RC)" 'ROW ADDRESS OF D5 DStartC = "=Cell(""row"",R[-1]C)" 'COLUMN ADDRESS OF D5 Worksheets(SetMonth).Range("E5").Select DEndR = "=Cell(""row"",RC)" 'ROW ADDRESS OF DEndC = "=Cell(""row"",R[-1]C)" How do I combine the variables DStartR and DStartC to give me a variable called StartLocation and variables DEndR and DEndC to give me a variable called EndLocation I then need to generate a calculation using these points which will update as their contents change. I was using a For LOOP to generate a Variable called DTOTAL, however once the script had finished, it wouldn't update when D5/E5 changed, as a result I need to generate a sum at a location that could potential change based on various generated information. ie run1 of the script could put DTOTAL at cell reference A22, however run2 of the script could put DTOTAL at cell reference A23 etc. as a result I need to use the following line of code I think ActiveCell.Value = "=sum(" & StartLocation &":" & EndLocation &)" I am unable to check the above as I cant' figure out how to generate StartLocation and EndLocation I am going to carry on trying to figure out how to do what I need to do, however if some1 can give me a heads up, it would be appreciated Thanks In Advance

    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