Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dim sh As Worksheet, sh1 As Worksheet, sh2 As Worksheet, sh3 As Worksheet
- Dim wb As Workbook, wb1 As Workbook, wb2 As Workbook, wb3 As Workbook
- wb.Activate
- 'Clears sheet contents
- sh1.Cells.ClearContents
- sh2.Cells.ClearContents
- sh3.Cells.ClearContents
- 'Applies filter to main file to categories based on who can see it, then pastes into different sheets
- With sh.Range("A2", "H300")
- .AutoFilter
- .AutoFilter Field:=1, Criteria1:="N", Operator:=xlOr, Criteria2:="Y"
- .Copy sh1.Range("A1")
- .AutoFilter Field:=1, Criteria1:="D", Operator:=xlOr, Criteria2:="Y"
- .Copy sh2.Range("A1")
- .AutoFilter Field:=1, Criteria1:="Y"
- .Copy sh3.Range("A1")
- .AutoFilter
- End With
- 'Copy filtered sheets from main file onto dropbox files(update) then saves and closes the file
- sh1.Cells.Copy
- wb1.Sheets("Sheet1").Cells.PasteSpecial
- wb1.Sheets("Sheet1").Range("A1:H300").Locked = True
- wb1.Save
- wb1.Close
- sh2.Cells.Copy
- wb2.Sheets("Sheet1").Cells.PasteSpecial
- wb2.Sheets("Sheet1").Range("A1:H300").Locked = True
- wb2.Save
- wb2.Close
- sh3.Cells.Copy
- wb3.Sheets("Sheet1").Cells.PasteSpecial
- wb3.Sheets("Sheet1").Range("A1:H300").Locked = True
- wb3.Save
- wb3.Close
- MsgBox ("Dropbox has been updated")
- Dim sh As Worksheet, sh1 As Worksheet, sh2 As Worksheet, sh3 As Worksheet
- Dim wb As Workbook, wb1 As Workbook, wb2 As Workbook, wb3 As Workbook
- 'Name of workbooks in dropbox
- Set wb1 = Workbooks("abc.xlsx")
- Set wb2 = Workbooks("abcdefghij.xlsx")
- Set wb3 = Workbooks("abcdeghjklm.xlsx")
- wb.Activate
- 'Clears sheet contents
- sh1.Cells.ClearContents
- sh2.Cells.ClearContents
- sh3.Cells.ClearContents
- 'Copy data from xxxxxxxxxx information sheet
- wb1.Sheets("sheet1").Cells.Copy
- sh1.Cells.PasteSpecial
- 'Copy data from xxxxxxxx information sheet
- wb2.Sheets("sheet1").Cells.Copy
- sh2.Cells.PasteSpecial
- 'Copy data from xxx xxxxxxxxx information sheet
- wb3.Sheets("sheet1").Cells.Copy
- sh3.Cells.PasteSpecial
- 'Name sheets in main file
- sh1.Name = "xxxxxxxxx"
- sh2.Name = "Dxxxxxxx"
- sh3.Name = "Dxx Dxxxxxxxxx"
- MsgBox ("Download complete")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement