WORKING PAPERS: EXCEL & VBA
The rolling forward of Working Papers was my initial reason for undertaking the project.
The code must remain reusable for each check box which defines the named range it will connect to.
Option Explicit
Sub RollFwd()
Dim I As String
'Set FA as variable name
I = Range(ActiveSheet.CheckBoxes(Application.Caller).LinkedCell).Offset(0, -2).Value
'Run Copy Paste Module
Call CopyPaste(I)
End Sub
Each Range which will be copy/pasted/cleared is named & prefixed with its Sheet name. The call function provides the prefix for the named range defined next to each check box. Each Sheet may then be built as needed using the pre-defined script.
If you're interested in seeing the code below, please reach out @sidtrengove
Sub CopyPaste(ByVal I As String)
'Define Variables
Dim StringOne As String
Dim StringTwo As String
Dim StringThree As String
Dim StringFour As String
Dim StringFive As String
Dim StringSix As String
Dim StringSeven As String
Dim StringEight As String
Dim StringNine As String
Dim StringTen As String
Dim StringEleven As String
Dim StringTwelve As String
Dim StringThirteen As String
Dim StringFourteen As String
'Create Variable Strings with I as variable
StringOne = I & "Copy"
StringTwo = I & "Paste"
StringThree = I & "Clear"
StringFour = I & "CopyYE"
StringFive = I & "PasteYE"
StringSix = I & "ClearYE"
StringSeven = I & "CopyExtra"
StringEight = I & "PasteExtra"
StringNine = I & "ClearExtra"
StringTen = I & "CopyExtraYE"
StringEleven = I & "PasteExtraYE"
StringTwelve = I & "ClearExtraYE"
StringThirteen = "ReportingMonth"
StringFourteen = I & "PasteDate""
'Run Copy Paste Actions with set variables
If Range("##removed to prevent html inspect##").Value = True Then
'For the purpose of no clear area
"##removed to prevent html inspect##"
"##removed to prevent html inspect##"
'Set YE areas
Dim CopyAreaYE As Range: Set CopyAreaYE = Range(StringFour)
Dim PasteAreaYE As Range: Set PasteAreaYE = Range(StringFive)
'Set extra areas
Dim CopyAreaExtra As Range: Set CopyAreaExtra = Range(StringSeven)
Dim PasteAreaExtra As Range: Set PasteAreaExtra = Range(StringEight)
Dim ClearAreaExtra As Range: Set ClearAreaExtra = Range(StringNine)
'Set YE extra areas
Dim CopyAreaExtraYE As Range: Set CopyAreaExtraYE = Range(StringTen)
Dim PasteAreaExtraYE As Range: Set PasteAreaExtraYE = Range(StringEleven)
Dim ClearAreaExtraYE As Range: Set ClearAreaExtraYE = Range(StringTwelve)
'Set date area
"##removed to prevent html inspect##"
"##removed to prevent html inspect##"
'Copy and paste YE
If Range("MonthNumber").Value = 1 Then
"##removed to prevent html inspect##"
"##removed to prevent html inspect##"
Application.CutCopyMode = False
"##removed to prevent html inspect##"
'Extra
CopyAreaExtraYE.Copy
PasteAreaExtraYE.PasteSpecial xlPasteValues
"##removed to prevent html inspect##"
"##removed to prevent html inspect##"
End If
'Copy and paste month to month
CopyArea.Copy
PasteArea.PasteSpecial xlPasteValues
Application.CutCopyMode = False
"##removed to prevent html inspect##"
'Copy and paste date
"##removed to prevent html inspect##"
"##removed to prevent html inspect##"
Application.CutCopyMode = False
'Clear
"##removed to prevent html inspect##"
'Clear extra
"##removed to prevent html inspect##"
End If
End Sub