View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Jon Peltier Jon Peltier is offline
external usenet poster
 
Posts: 6,582
Default Sheets("Sheet").Copy problem

You realize that the "End" statement completely ends execution? I wonder if
this is happening. The Sheets().Copy otherwise should work fine to create a
new workbook with just the indicated sheet.

Have you stepped through the code in the debugger? Where does the execution
trail take you?

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"Brian" wrote in message
...
Hi All,

I have a series of Case Statements which will write to a report sheet. I
then want to copy the sheet to a new workbook. I have placed the command
Sheets("Report").Copy in various places, but it does nothing. Any
suggestions
as to what I am doing wrong?
Private Sub ComboBox1_click()
Dim i As Long, rng As Range
Dim refrange As Range
Dim c As Range

ComboBox2.ListIndex = -1
ComboBox3.ListIndex = -1
ComboBox4.ListIndex = -1
ComboBox5.ListIndex = -1

Select Case ComboBox1.Value
Case "GSOP_0286"
Sheets("Report").Range("A4:I20").Clear
Set refrange = Sheets("Sheet2").Range("A3:A20")
i = 0
For Each c In refrange
If c.Value = "" Then
End
Else
s = Replace(c.Formula, "=", "")
Set rng = Evaluate(s)
rng.EntireRow.Copy
Sheets("Report").Range("A4") _
.Offset(i, 0) _
.PasteSpecial Paste:= _
xlPasteAll, _
Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
i = i + 1
End If
Next c
[More Case Statements]

End Select
Sheets ("Report").Select
Sheets ("Report").Copy

Thanks,

--
Brian McCaffery