VBA Macro record data + Auto saving multiple sheets into 1 every hour

Rillo

New Member
Joined
Jul 2, 2019
Messages
4
Hello,

I have a few small things I need help with. So, I have 3 pc's each with a workbook; Station1, Station2 & Station3 and each work book has 2 sheets. Sheet 1 has 3 cells which can be edited by the user the rest of the sheet is protected. I have set up a macro linked to a command button called "print" which prints the label with the data entered and then copies the data into a table on Sheet2 for the record.

1) Currently it does just the above, however I would like it to first check if the data entered into cell Q3 (example) matches anything in column B on Sheet2, if it does then don't copy anything just print the label requested. (In-case the user needs to print a label twice, I don't want it to copy the same data twice).

2) Once every hour I want the data from Sheet2 on all 3 pc's to be saved on a shared drive into 1 workbook and then that same workbook be updated every hour. (if that's possible)

3)Would it be possible to make Sheet2 read-only and still record data into it with the macro? I want to prevent anyone from tampering with the data in Sheet2. (currently just using the hide sheet method and trusting everyone not to mess about with it) I tried to protect it but get an error when the macro runs.

Code:
Private Sub CommandButton2_Click()
Range("Q4").Select
For i = 1 To Range("Q4")
Sheets(1).Range("A13") = i
'Application.ActivePrinter = "HP:"
Sheets("Sheet1").PrintOut
Next i
 
erw = Sheet2.Cells(1, 1).CurrentRegion.Rows.Count + 1
 
    Sheet2.Cells(erw, 1) = Range("Q2")
    Sheet2.Cells(erw, 2) = Range("Q3")
    Sheet2.Cells(erw, 3) = Range("Q4")
    Sheet2.Cells(erw, 4) = Range("A14")
   
    Range("Q3") = ""
    Range("Q4") = ""
 
End Sub
Feel free to "clean up" the code if needed. This is just what I came up with by searching the web and following some tutorials.
If you need anymore information to help me with this then please just ask.
Thank you for taking the time to read this.
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Sorry to bump so soon but I couldn't find the Edit button on the thread :confused:

I wanted to clarify step 2) copy all three Sheet2's from each pc and save it in a single workbook under different tabs... it would be name PC1, PC2.. etc instead of Sheet2 and then update every hour with the new fields added to the bottom of the list.
 
Upvote 0
So I figured out how to prevent it from copying duplicate data and just printing.

I just need help with saving "Sheet2" from multiple PC's (3) into a single workbook on PC 4 (without copying duplicates of column B from all 3 sheets) and have it auto update as new data is entered into "Sheet2" on any PC.

Thanks in advance to anyone that can help.
 
Upvote 0

Forum statistics

Threads
1,223,705
Messages
6,173,996
Members
452,542
Latest member
Bricklin

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