Moving closing balances to opening balance on a new sheet using VBA

Derek Armitage

New Member
Joined
Jul 25, 2023
Messages
1
Office Version
  1. 2016
Platform
  1. Windows
Moving Closing Balance to Opening balances.xlsx
B
3
Sheet1


Hello

I'm looking to move closing balances to opening balance on a new sheet using VBA. See mini sheet at top.

Goal:
1) Copy a new sheet outlined in the VBA code

'Copy Sheet
ThisWorkbook.Sheets(1).Copy after:=Sheets(1)
Set ws = ThisWorkbook.ActiveSheet

'Rename Sheet
ws.Name = wsname
ws.Move Before:=ThisWorkbook.Sheets(1)

2) On the new sheet
a) Find the "closing cash balances" in F (column is static and will not change). However the "closing cash balance" row numbers will be dynamic (depending on the number of transactions).
b) Take the "closing cash balances" and put them as "opening cash balances" in F7 and F8. The "opening cash balances" will be static and will not change.

3) On the new sheet
a) add one year in the date cells in B7 and B8. The cell references will also be static as they are associated with the "opening cash balances"
b) add one year in the date cells in column B with respect to the "closing cash balance" which will be dynamic.
c) is it possible to take into account leap years. Not a big deal if it is not possible.
Thanks
Derek
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

Forum statistics

Threads
1,215,095
Messages
6,123,072
Members
449,093
Latest member
ripvw

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