Private Sub CommandButton6_Click()
'Select the entire Capitla View Forecast sheet and delete all contents to start empty
Sheets("Capital View Forecast").Select
Sheets("Capital View Forecast").Cells.ClearContents
'Select the range of values from the Master List tab that is needed on the Capital View Forecast tab and paste special the values onto the Capital View Forecast Tab.
Sheets("Master List").Select
Sheets("Master List").Range("A2:K1000").Select
Selection.Copy
Sheets("Capital View Forecast").Select
Sheets("Capital View Forecast").Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteColumnWidths, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
ActiveSheet.Paste
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
'Delete unused columns on the Capital View Forecast Tab
Sheets("Capital View Forecast").Select
Sheets("Capital View Forecast").Range("C:C,D:D,F:F,G:G,H:H,I:I,J:J").Select
Selection.Delete
'Rearrange columns on Capital View Forecast tab to match desired format
Sheets("Capital View Forecast").Select
Sheets("Capital View Forecast").Columns("D:D").Select
Selection.Cut
Sheets("Capital View Forecast").Columns("A:A").Select
Selection.Insert Shift:=xlToRight
Sheets("Capital View Forecast").Select
Sheets("Capital View Forecast").Columns("C:C").Select
Selection.Cut
Sheets("Capital View Forecast").Columns("B:B").Select
Selection.Insert Shift:=xlToRight
'Set active cell as D2 before starting Loop
Sheets("Capital View Forecast").Range("D2").Select
'Run loop that deletes the entire row if the value in the Capitalized Licenses column is blank
Do
If ActiveCell.Value = 0 Then
Selection.EntireRow.Delete
End If
'If there is a value in the Capitalized Licenses column then leave unchanged and move to next row below
If ActiveCell.Value <> 0 Then
ActiveCell.Offset(1, 0).Activate
End If
'Loop until there is no value in the Supplier column
Loop Until IsEmpty(ActiveCell.Offset(0, -1))
'Move back to cell A2
Sheets("Capital View Forecast").Select
Sheets("Capital View Forecast").Range("A2").Activate
'Copy and Paste the columns for quarter values from other tab
Sheets("OLD Capital View Forecast").Select
Sheets("OLD Capital View Forecast").Range("E1:O1").Select
Selection.Copy
Sheets("Capital View Forecast").Select
Sheets("Capital View Forecast").Range("E1").Select
Selection.PasteSpecial Paste:=xlPasteColumnWidths, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
ActiveSheet.Paste
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
'Move to cell A2 and Begin 2nd Loop to move Capitalized Licenses Value to respective Quarter column
Sheets("Capital View Forecast").Select
Sheets("Capital View Forecast").Range("A2").Activate
Do
If ActiveCell.Value = Q406 Then
ActiveCell.Offset(0, 4).Select
ActiveCell.FormulaR1C1 = "=RC[-1]"
ActiveCell.Offset(0, -4).Activate
End If
If ActiveCell.Value = Q107 Then
ActiveCell.Offset(0, 5).Select
ActiveCell.FormulaR1C1 = "=RC[-2]"
ActiveCell.Offset(0, -5).Activate
End If
If ActiveCell.Value = Q207 Then
ActiveCell.Offset(0, 6).Select
ActiveCell.FormulaR1C1 = "=RC[-3]"
ActiveCell.Offset(0, -6).Activate
End If
ActiveCell.Offset(1, 0).Select
Loop Until IsEmpty(ActiveCell.Offset(0, 0))
End Sub
Bookmarks