Clearing Contents in range of cells on a master file?

Rscottq

New Member
Joined
Nov 22, 2021
Messages
19
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Ok guys, After poking around on a couple of solutions here is what I have to save my "Master File" as a date stamped copy.xlsx. But then I would like the Sub or Private sub to clear the contents of ranges of cells on the master file and NOT affect the datestamped version.

To give you a better idea perhaps, the masterfile is hung in sharepoint where everyone has access to put in their daily locations. Once all have reported, I save that as today's report (date stamp), then clear the contents and reset the date for the next business day. I'd be saving quite the few clicks to be able to write this in. I also then take one sheet of the master file and copy its over into a separate file which goes up to the director's office every day. So in essence, I'm working with two Master files. Our Division's version where everyone goes into mark locations on one sheet, the director's version sheet which is a lot of "countif(s)" generating numbers onto the Director's version sheet. Then I have a Director's version WB with just the one sheet, where I copy over the sheet out of the Division WB.

Learning all this VBA stuff would help eliminate all the copy/paste/clear/save as clicking through each day, and also simplify things for anyone having to do this in my absence.

Anywho, here's the code I have that you all helped with yesterday. Now to start piecing together the clearing contents, then copy over one sheet to the other WB, etc.

Sub SaveToday()
Application.DisplayAlerts = False
ThisWorkbook.SaveAs ThisWorkbook.Path & "\" & "Learning-" & Format(Now, "yyyymmdd"), 51
Application.DisplayAlerts = True

End Sub
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Ok, I've gone on to one of the other steps and gotten this so far, but keep getting an error on the CloseL2 Sub.

I'm assuming, I would then write(or move) the VBA code to save as today with datestamp in between or before I open "L2"? This is kinda fun to learn and tweak. Thanks in advance.

Sub OpenL2()
Workbooks.Open "C:\test\Learning2.xlsx"

End Sub
Sub CopyDirector()

ThisWorkbook.worsheet("Sheet2").Range(row3 - 26).copy_workbook ("learning2.xlsx")

End Sub

Sub CloseL2()

Workbooks("C:\test\Learning2.xlsx").Close, SaveChanges"C:\test\learning2.xlsx" = True

End Sub
 
Upvote 0

Forum statistics

Threads
1,214,985
Messages
6,122,602
Members
449,089
Latest member
Motoracer88

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