ryan0521
Board Regular
- Joined
- Dec 7, 2016
- Messages
- 79
Code:
'one
If mwkb.Sheets("Cover Sheet").Range("ab11").Value = 1 Then
Set Wkb = Workbooks.Open(PATH1)
mwkb.Sheets("1").Cells.ClearContents
Wkb.ActiveSheet.Cells.Copy
mwkb.Activate
Sheets("1").Select
Range("A1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("A1:N130").Select
With Selection
.NumberFormat = "General"
.Value = .Value
End With
Range("A1").Select
Wkb.Close savechanges:=False
Cnt = Cnt + 1
r = r + 1
End If
'two
If mwkb.Sheets("Cover Sheet").Range("ab11").Value = 2 Then
Set Wkb = Workbooks.Open(PATH1)
mwkb.Sheets("1").Cells.ClearContents
Wkb.ActiveSheet.Cells.Copy
mwkb.Activate
Sheets("1").Select
Range("A1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("A1:N130").Select
With Selection
.NumberFormat = "General"
.Value = .Value
End With
Range("A1").Select
Wkb.Close savechanges:=False
Cnt = Cnt + 1
r = r + 1
Set Wkb = Workbooks.Open(PATH2)
mwkb.Sheets("2").Cells.ClearContents
Wkb.ActiveSheet.Cells.Copy
mwkb.Activate
Sheets("2").Select
Range("A1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("A1:N130").Select
With Selection
.NumberFormat = "General"
.Value = .Value
End With
Range("A1").Select
Wkb.Close savechanges:=False
Cnt = Cnt + 1
r = r + 1
End If
'three
If mwkb.Sheets("Cover Sheet").Range("ab11").Value = 3 Then
Set Wkb = Workbooks.Open(PATH1)
mwkb.Sheets("1").Cells.ClearContents
Wkb.ActiveSheet.Cells.Copy
mwkb.Activate
Sheets("1").Select
Range("A1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("A1:N130").Select
With Selection
.NumberFormat = "General"
.Value = .Value
End With
Range("A1").Select
Wkb.Close savechanges:=False
Cnt = Cnt + 1
r = r + 1
Set Wkb = Workbooks.Open(PATH2)
mwkb.Sheets("2").Cells.ClearContents
Wkb.ActiveSheet.Cells.Copy
mwkb.Activate
Sheets("2").Select
Range("A1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("A1:N130").Select
With Selection
.NumberFormat = "General"
.Value = .Value
End With
Range("A1").Select
Wkb.Close savechanges:=False
Cnt = Cnt + 1
r = r + 1
Set Wkb = Workbooks.Open(PATH3)
mwkb.Sheets("3").Cells.ClearContents
Wkb.ActiveSheet.Cells.Copy
mwkb.Activate
Sheets("3").Select
Range("A1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("A1:N130").Select
With Selection
.NumberFormat = "General"
.Value = .Value
End With
Range("A1").Select
Wkb.Close savechanges:=False
Cnt = Cnt + 1
r = r + 1
End If
'four
If mwkb.Sheets("Cover Sheet").Range("ab11").Value = 4 Then
Set Wkb = Workbooks.Open(PATH1)
mwkb.Sheets("1").Cells.ClearContents
Wkb.ActiveSheet.Cells.Copy
mwkb.Activate
Sheets("1").Select
Range("A1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("A1:N130").Select
With Selection
.NumberFormat = "General"
.Value = .Value
End With
Range("A1").Select
Wkb.Close savechanges:=False
Cnt = Cnt + 1
r = r + 1
Set Wkb = Workbooks.Open(PATH2)
mwkb.Sheets("2").Cells.ClearContents
Wkb.ActiveSheet.Cells.Copy
mwkb.Activate
Sheets("2").Select
Range("A1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("A1:N130").Select
With Selection
.NumberFormat = "General"
.Value = .Value
End With
Range("A1").Select
Wkb.Close savechanges:=False
Cnt = Cnt + 1
r = r + 1
Set Wkb = Workbooks.Open(PATH3)
mwkb.Sheets("3").Cells.ClearContents
Wkb.ActiveSheet.Cells.Copy
mwkb.Activate
Sheets("3").Select
Range("A1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("A1:N130").Select
With Selection
.NumberFormat = "General"
.Value = .Value
End With
Range("A1").Select
Wkb.Close savechanges:=False
Cnt = Cnt + 1
r = r + 1
Set Wkb = Workbooks.Open(PATH4)
mwkb.Sheets("4").Cells.ClearContents
Wkb.ActiveSheet.Cells.Copy
mwkb.Activate
Sheets("4").Select
Range("A1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("A1:N130").Select
With Selection
.NumberFormat = "General"
.Value = .Value
End With
Range("A1").Select
Wkb.Close savechanges:=False
Cnt = Cnt + 1
r = r + 1
End If
'five
If mwkb.Sheets("Cover Sheet").Range("ab11").Value = 5 Then
Set Wkb = Workbooks.Open(PATH1)
mwkb.Sheets("1").Cells.ClearContents
Wkb.ActiveSheet.Cells.Copy
mwkb.Activate
Sheets("1").Select
Range("A1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("A1:N130").Select
With Selection
.NumberFormat = "General"
.Value = .Value
End With
Range("A1").Select
Wkb.Close savechanges:=False
Cnt = Cnt + 1
r = r + 1
Set Wkb = Workbooks.Open(PATH2)
mwkb.Sheets("2").Cells.ClearContents
Wkb.ActiveSheet.Cells.Copy
mwkb.Activate
Sheets("2").Select
Range("A1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("A1:N130").Select
With Selection
.NumberFormat = "General"
.Value = .Value
End With
Range("A1").Select
Wkb.Close savechanges:=False
Cnt = Cnt + 1
r = r + 1
Set Wkb = Workbooks.Open(PATH3)
mwkb.Sheets("3").Cells.ClearContents
Wkb.ActiveSheet.Cells.Copy
mwkb.Activate
Sheets("3").Select
Range("A1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("A1:N130").Select
With Selection
.NumberFormat = "General"
.Value = .Value
End With
Range("A1").Select
Wkb.Close savechanges:=False
Cnt = Cnt + 1
r = r + 1
Set Wkb = Workbooks.Open(PATH4)
mwkb.Sheets("4").Cells.ClearContents
Wkb.ActiveSheet.Cells.Copy
mwkb.Activate
Sheets("4").Select
Range("A1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("A1:N130").Select
With Selection
.NumberFormat = "General"
.Value = .Value
End With
Range("A1").Select
Wkb.Close savechanges:=False
Cnt = Cnt + 1
r = r + 1
Set Wkb = Workbooks.Open(PATH5)
mwkb.Sheets("5").Cells.ClearContents
Wkb.ActiveSheet.Cells.Copy
mwkb.Activate
Sheets("5").Select
Range("A1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("A1:N130").Select
With Selection
.NumberFormat = "General"
.Value = .Value
End With
Range("A1").Select
Wkb.Close savechanges:=False
Cnt = Cnt + 1
r = r + 1
End If
'six
If mwkb.Sheets("Cover Sheet").Range("ab11").Value = 6 Then
Set Wkb = Workbooks.Open(PATH1)
mwkb.Sheets("1").Cells.ClearContents
Wkb.ActiveSheet.Cells.Copy
mwkb.Activate
Sheets("1").Select
Range("A1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("A1:N130").Select
With Selection
.NumberFormat = "General"
.Value = .Value
End With
Range("A1").Select
Wkb.Close savechanges:=False
Cnt = Cnt + 1
r = r + 1
Set Wkb = Workbooks.Open(PATH2)
mwkb.Sheets("2").Cells.ClearContents
Wkb.ActiveSheet.Cells.Copy
mwkb.Activate
Sheets("2").Select
Range("A1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("A1:N130").Select
With Selection
.NumberFormat = "General"
.Value = .Value
End With
Range("A1").Select
Wkb.Close savechanges:=False
Cnt = Cnt + 1
r = r + 1
Set Wkb = Workbooks.Open(PATH3)
mwkb.Sheets("3").Cells.ClearContents
Wkb.ActiveSheet.Cells.Copy
mwkb.Activate
Sheets("3").Select
Range("A1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("A1:N130").Select
With Selection
.NumberFormat = "General"
.Value = .Value
End With
Range("A1").Select
Wkb.Close savechanges:=False
Cnt = Cnt + 1
r = r + 1
Set Wkb = Workbooks.Open(PATH4)
mwkb.Sheets("4").Cells.ClearContents
Wkb.ActiveSheet.Cells.Copy
mwkb.Activate
Sheets("4").Select
Range("A1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("A1:N130").Select
With Selection
.NumberFormat = "General"
.Value = .Value
End With
Range("A1").Select
Wkb.Close savechanges:=False
Cnt = Cnt + 1
r = r + 1
Set Wkb = Workbooks.Open(PATH5)
mwkb.Sheets("5").Cells.ClearContents
Wkb.ActiveSheet.Cells.Copy
mwkb.Activate
Sheets("5").Select
Range("A1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("A1:N130").Select
With Selection
.NumberFormat = "General"
.Value = .Value
End With
Range("A1").Select
Wkb.Close savechanges:=False
Cnt = Cnt + 1
r = r + 1
Set Wkb = Workbooks.Open(PATH6)
mwkb.Sheets("6").Cells.ClearContents
Wkb.ActiveSheet.Cells.Copy
mwkb.Activate
Sheets("6").Select
Range("A1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("A1:N130").Select
With Selection
.NumberFormat = "General"
.Value = .Value
End With
Range("A1").Select
Wkb.Close savechanges:=False
Cnt = Cnt + 1
r = r + 1
End If
Last edited by a moderator: