Creater1222
New Member
- Joined
- Oct 3, 2018
- Messages
- 11
Okay so this is a new thread because im needing something else now.
okay so i have 4 worksheets. Lets just call them 1-2-3-4 for now.
In worksheet 4 i use this code
What this does is it makes a new chart / table however you want to call it. When i press my button. And it just does it like 5 charts from left to right and then from top to bottom it makes 5000. so in the end i have 25000 charts/tables. Now in worksheet 2 i have a formula. This formula needs to get editted everytime i add a new chart. Because this 1 formula needs all the values from all the charts ever made. So i need a code that just everytime i press my button it automatically updates the formula. The formula should have all the ranges from all the charts in it. This is so i can calculate a TOTAL basically. if you need more information or anything let me know!
okay so i have 4 worksheets. Lets just call them 1-2-3-4 for now.
In worksheet 4 i use this code
Code:
Sub CopyToCorrectRanges() Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Dim rng1 As Range
Dim rng2 As Range
Dim rng3 As Range
Dim rng4 As Range
Dim cel As Range
Dim h As Long
Dim d As Integer
Dim i As Integer
Set rng1 = Range("A1:H102")
Set rng2 = Range("B3:D102")
Set rng3 = Range("F3:H102")
Set rng4 = Range("A1:H1")
Set cel = Range("B3")
For d = 0 To 5000
For i = 0 To 4
If d = 0 And i = 0 Then i = 1
If cel.Offset(103 * d, 9 * i) = "" Then
rng4.ClearContents
rng4.Value = "Chart " & i + d * 5
rng1.Copy rng1.Offset(103 * d, 9 * i)
rng2.ClearContents
rng3.ClearContents
rng4.ClearContents
rng4.Value = "Main Chart"
GoTo TheEnd
End If
Next i
Next d
TheEnd:
Application.Calculation = xlCalculationAutomatic
MsgBox "Chart " & i + d * 5 & " has been succesfully made"
End Sub