In need of some help / a code

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
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
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!
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
I'm not sure how to do it really. But maybe its possible to make 2 loops again and something like set rng 5 = range in ur loop? dunno someone else should help you.
 
Upvote 0
Hmm i see your logic but i just dont know how to do it what you mean really. I think someone else need to help me with this :s. Thanks for the effort though! Appreciate it
 
Upvote 0
https://snag.gy/Lx1seZ.jpg
So that is my worksheet. Now in the left chart thing u can see that it needs the total, the right is what its at at the moment. But the total needs to be calculated with the current + all the previous charts. and the previous charts keep coming. Because this current chart right now. if i add a new one then that chart will be stored on a other worksheet. So everytime i make a new chart the old current one will be saved. but i still need those numbers for my total. i dont know where to start this time tbh
 
Upvote 0
i tried using something with loops but i dont know which vba code to use to kinda like increment the range? dunno i can't seem to work my head out. please if someone can help i would love it...
 
Upvote 0
bump

[EDIT]
I'm bumping this because i have a similar problem and i haven't seen Creater1222 around anymore. but i still need an answer but im not allowed to make a similar thread?
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,603
Messages
6,179,849
Members
452,948
Latest member
UsmanAli786

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top