Issue: Everything works fine with this code, but the last section which is marked not working.
Objective:To copy the value from one worksheet to the other.
I am using Excel 2010. Any help would be appreciated...
Objective:To copy the value from one worksheet to the other.
Code:
Private Sub CommandButton1_Click()
Dim text As String
Dim i As Integer
For i = 0 To Me.ListBox1.ListCount - 1
If Me.ListBox1.Selected(i) Then
text = text & Me.ListBox1.List(i) & vbNewLine
End If
Next i
MsgBox "Items you selected: " & vbNewLine & text
GetSelectedItemsText = text
Dim wks As Worksheet
For Each wks In ActiveWindow.SelectedSheets
wks.Select
Range("G3:G9").Select
Selection.Copy
Sheets("SPA_SummaryVIEW").Select
Range("C6").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
wks.Select
Range("O1").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("SPA_SummaryVIEW").Select
Range("C5").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Columns("C:C").EntireColumn.AutoFit
Range("C6").Select
Application.CutCopyMode = False
Selection.Style = "Percent"
Selection.NumberFormat = "0.0%"
Selection.NumberFormat = "0.00%"
Range("C7:C12").Select
Selection.Style = "Currency"
Range("C4").Select
'**NOT WORKING** This section is giving me the problem. I want to copy the value from the variable wks and paste into SPA_SummaryView.
wks.Select
Range("O1").Select
Selection.Copy
Range("O8").Select
Sheets("SPA_SummaryVIEW").Select
Range("C5").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("C15").Select
Columns("C:C").EntireColumn.AutoFit
Range("C2").Select
Next
Unload Me
End Sub
I am using Excel 2010. Any help would be appreciated...