Home Adding a range of cells from 2 worksheets
Reply: 0

Adding a range of cells from 2 worksheets

user5991
1#
user5991 Published in September 19, 2018, 9:08 am

I have a working code that allows me to add all sheets in a folder and pivot tables summing up an inventory form. I've now been tasked with trying to create a running total page where we can take a second worksheet and just add or subtract how many items are entered in the total row. I've pieced together this code which works to an extent of what I need.

Dim Add As Integer
Dim var1 As Integer
Dim var2 As Integer
var1 = Worksheets("Sheet1").Range("D6").Value
var2 = Worksheets("add").Range("F6").Value
Add = var1 + var2
Worksheets("Sheet1").Range("D6").Select
ActiveCell.FormulaR1C1 = Add
Application.DisplayAlerts = False
Sheets("add").Select
ActiveWindow.SelectedSheets.Delete
Sheets("Sheet1").Select

This however only works for a single cell and I need it to work for a range from D4 to D649 on Sheet1. I can't for the life of me think of the solution to this and I can't seem to find the solution in reference to multiple sheets and multiple cells.

share|improve this question
  • What do you mean you need it to work on a range? Do you need to add each cell in D4:D649 to F6 on the other sheet? – BruceWayne Apr 16 at 19:39
  • Ah sorry. I have Sheet1 D4 - D649 as my running totals. I have my code add another sheet from another workbook and names the sheet to "add". Then I need it to add up any number entered on sheet "add" from F4 - F649 to my running total on Sheet1. Hopefully that clears it up – J Doncouse Threedogbowwow Apr 16 at 19:44

3 Answers 3

active oldest votes
up vote 0 down vote
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.356142 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO