• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Copy Multiple Workksheet into new Workbook

asparagus

Member
Dear Master,

I need copy two worksheet from workbook A and create workbook B and paste the copied from multiple worksheet in the new workbook.

this is my code

Code:
Private Sub Workbook_Open()
  Worksheets("Monitoring List CKD NSeries").Select 'tambahin worksheet kalo mau jalanin sheet yang berbeda
  
  Dim stDate As Long: stDate = Date + 2
  Dim stDate1 As Long: stDate1 = Date + 4
  
  'For Each cell In Range("B7:B1994") 'range cell
  
  Range("B6:B2000").AutoFilter 1, Criteria1:=">" & stDate, _
  Operator:=xlAnd, Criteria2:="<" & stDate1
  Range("A6:EW2000").Copy
  
  Workbooks.Add
  [A4].PasteSpecial xlPasteAll
  ActiveWorkbook.SaveAs "D:\Users\muhammad.galih\Desktop\Reminder Monitoring Lot " & Format(Now, "dd-mmm-yy") & ".xls"
  ActiveWorkbook.Close False
  
  
  
  For Each cell In Range("B7:B1994") 'range cell
  If cell.Value = Date + 3 Then
  Cells(3, 2).Interior.ColorIndex = 3
  Cells(3, 2).Font.ColorIndex = 1
  Range("B3").Value = cell.Value 'menampilkan tanggal yang sesuai dengan tanggal hari ini +3
  SendReminderMail
  Else
  End If
  Next
  
  Worksheets("Monitoring List CKD F-Series").Select
  
  'For Each cell In Range("B7:B1994") 'range cell
  
  Range("B6:B2000").AutoFilter 1, Criteria1:=">" & stDate, _
  Operator:=xlAnd, Criteria2:="<" & stDate1
  Range("A6:EW2000").Copy
  
  Workbooks.Add
  [A4].PasteSpecial xlPasteAll
  ActiveWorkbook.SaveAs "D:\Users\muhammad.galih\Desktop\Reminder Monitoring Lot " & Format(Now, "dd-mmm-yy") & ".xls"
  ActiveWorkbook.Close False
  
  
  
  For Each cell In Range("B7:B1994") 'range cell
  If cell.Value = Date + 3 Then
  Cells(3, 2).Interior.ColorIndex = 3
  Cells(3, 2).Font.ColorIndex = 1
  Range("B3").Value = cell.Value 'menampilkan tanggal yang sesuai dengan tanggal hari ini +3
  SendReminderMail
  Else
  End If
  Next
End Sub

The problem, when i'm running VBA excel,Worksheet not paste in the one workbook but create new workbook to each worksheet

Thanks,
 
Back
Top