Change destination VBA

bullcreel

Board Regular
Joined
Aug 25, 2016
Messages
157
Office Version
  1. 2021
Platform
  1. Windows
This VBA works great, however, I need to change it up because the new worksheets I have developed dont match up identical like this VBA suggests. "CleGame" current row is now 99 to 133 and current Column is 9 to 62. I think I can fix this part. The part I am struggling with is the new destination sheet "Cle". The information doesnt match "CleGame" any longer, the data needs to go in worksheet "Cle" cell ranges (b4:R39). I no longer need to ClearContents either. Thanks in advance for your help.

sub GameStatsCle()

Dim CurrentRow

For CurrentRow = 4 To 39
For CurrentColumn = 2 To 17
Sheets("Cle").Cells(CurrentRow, CurrentColumn).Value = Sheets("CleGame").Cells(CurrentRow, CurrentColumn).Value + Sheets("Cle").Cells(CurrentRow, CurrentColumn).Value

Next CurrentColumn
Next CurrentRow

For CurrentRow = 43 To 60
For CurrentColumn = 2 To 19
Sheets("Cle").Cells(CurrentRow, CurrentColumn).Value = Sheets("CleGame").Cells(CurrentRow, CurrentColumn).Value + Sheets("Cle").Cells(CurrentRow, CurrentColumn).Value
Next CurrentColumn
Next CurrentRow

Sheets("CleGame").Range("b4:R36").ClearContents
Sheets("CleGame").Range("b4:R36").Style = "Normal"
Sheets("CleGame").Range("b43:P60").ClearContents
Sheets("CleGame").Range("b43:P60").Style = "Normal"

End Sub
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
try this in place of all you have there
VBA Code:
Sub GameStatsCle()
    Dim CurrentRow As Long, CurrentColumn As Long
    
    For CurrentRow = 4 To 39
        For CurrentColumn = 2 To 17
            Sheets("Cle").Cells(CurrentRow, CurrentColumn).Value = Sheets("CleGame").Cells(CurrentRow + 95, CurrentColumn).Value + Sheets("Cle").Cells(CurrentRow, CurrentColumn).Value
        Next CurrentColumn
    Next CurrentRow
End Sub
 
Upvote 0
Diddi
I already have a solution. Thank You so much for the response.
 
Upvote 0

Forum statistics

Threads
1,215,418
Messages
6,124,793
Members
449,189
Latest member
kristinh

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