View Single Post
  #14   Report Post  
Posted to microsoft.public.excel.programming
Corey Corey is offline
external usenet poster
 
Posts: 276
Default Error in PasteSpecial ?

I now get NO ERROR, but i also get NO Pasting into the other sheet??
Seems to Copy the range though???

"Ken Puls" wrote in message
...
Okay, just for fun, let's try stopping events while we do this...

Sub TimeSheets()
On Error Goto ExitPoint
Application.EnableEvents = False
Sheets("AAA").Range("A1:U41").Insert
Sheets("ZZZ").Range("a1:u41").Copy
Sheets("AAA").Range("A1").PasteSpecial Paste:=xlPasteAll
ExitPoint:
Application.EnableEvents = True
End Sub

Give that a shot and let me know...

Ken Puls, CMA - Microsoft MVP (Excel)
www.excelguru.ca

Corey wrote:
Yes cloed and re-run, with the same error.
I have other codes such as a code to convert cell ranges to times from a
(0730,1545) input value. Below:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)

Dim TimeStr As String

On Error GoTo EndMacro
If Application.Intersect(Target,
Range("C7:C8,C11:C12,C15:C16,F7:F8,F11:F12,F15:F16 ,I7:I8,I11:I12,I15:I16,L7:L8,L11:L12,L15:L16,O7:O8 ,O11:O12,O15:O16,R7:R8,R11:R12,R15:R16,U7:U8,U11:U 12,U15:U16,V2:X2"))
Is Nothing Then
Exit Sub
' If Application.Intersect(Target,
Range("C7:C8,C11:C12,C15:C16,C19:C20,C23:C24,F7:F8 ,F11:F12,F15:F16,F19:F20,F23:C24,I7:I8,I11:I12,I15 :I16,I19:I20,I23:I24,L7:L8,L11:L12,L15:L16,L19:L20 ,L23:L24,O7:O8,O11:O12,O15:O16,O19:O20,O23:O24,R7: R8,R11:R12,R19:R20,R23:R24,U7:U8,U11:U12,U19:U20,U 23:U24,V2:X2"))
Is Nothing Then
End If
If Target.Cells.Count 1 Then
Exit Sub
End If
If Target.Value = "" Then
Exit Sub
End If ' this is code

Application.EnableEvents = False
With Target
If .HasFormula = False Then
Select Case Len(.Value)
Case 1 ' e.g., 1 = 00:01 AM
TimeStr = "00:0" & .Value
Case 2 ' e.g., 12 = 00:12 AM
TimeStr = "00:" & .Value
Case 3 ' e.g., 735 = 7:35 AM
TimeStr = Left(.Value, 1) & ":" & _
Right(.Value, 2)
Case 4 ' e.g., 1234 = 12:34
TimeStr = Left(.Value, 2) & ":" & _
Right(.Value, 2)
Case 5 ' e.g., 12345 = 1:23:45 NOT 12:03:45
TimeStr = Left(.Value, 1) & ":" & _
Mid(.Value, 2, 2) & ":" & Right(.Value, 2)
Case 6 ' e.g., 123456 = 12:34:56
TimeStr = Left(.Value, 2) & ":" & _
Mid(.Value, 3, 2) & ":" & Right(.Value, 2)
Case Else
Err.Raise 0
End Select
.Value = TimeValue(TimeStr)
End If
End With
Application.EnableEvents = True
Exit Sub
EndMacro:
MsgBox "You did not enter a valid time"
Application.EnableEvents = True
End Sub

AND

rivate Sub CommandButton1_Click()
'
' Graph1 Macro
' Macro recorded 4/10/2006 by Corey
'
Application.ScreenUpdating = False

'
Charts.Add
ActiveChart.ChartType = xl3DColumn
ActiveChart.SetSourceData Source:=Sheets("Utilization
Sheet").Range("K27")
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(1).Values = "='Utilization
Sheet'!R3C23:R4C23"
ActiveChart.SeriesCollection(1).Name = "='Utilization Sheet'!R2C23"
ActiveChart.SeriesCollection(2).Values = "='Utilization Sheet'!R3C24"
ActiveChart.SeriesCollection(2).Name = "='Utilization Sheet'!R2C24"
ActiveChart.SeriesCollection(3).Values = "='Utilization Sheet'!R4C25"
ActiveChart.SeriesCollection(3).Name = "='Utilization Sheet'!R2C25"
ActiveChart.Location Whe=xlLocationAsObject, Name:="Utilization
Sheet"
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = "John Coleiro"
.Axes(xlCategory).HasTitle = False
.Axes(xlSeries).HasTitle = False
.Axes(xlValue).HasTitle = False
End With
With ActiveChart.Axes(xlCategory)
.HasMajorGridlines = True
.HasMinorGridlines = False
End With
With ActiveChart.Axes(xlSeries)
.HasMajorGridlines = False
.HasMinorGridlines = False
End With
With ActiveChart.Axes(xlValue)
.HasMajorGridlines = True
.HasMinorGridlines = False
End With
ActiveChart.WallsAndGridlines2D = False
ActiveChart.HasLegend = True
ActiveChart.Legend.Select
Selection.Position = xlBottom
ActiveChart.SeriesCollection(1).Select
Selection.BarShape = xlCylinder
ActiveChart.SeriesCollection(2).Select
Selection.BarShape = xlCylinder
ActiveChart.SeriesCollection(3).Select
Selection.BarShape = xlCylinder

With ActiveChart
.Elevation = 15
.Perspective = 30
.Rotation = 40
.RightAngleAxes = False
.HeightPercent = 100
.AutoScaling = True
.ChartArea.Select
End With
Range("a1").Select
End Sub

x about 20 to create some charts.

Other than that NO other codes..

Corey....