LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default need some help, encounter run-time error 1004

Hi

I enounter run-time error 1004 when i try to copy & paste my data to a
starting cell A8

Extract from visual basic
The information cannot be pasted because the copy area & the paste
area are not the same size & shape.


The code below works fine when i select an item BUT the error arises
when i choose to display all the items .

my code is residing in a worksheet

Private Sub Worksheet_Change(ByVal Target As Range)
'allow user to choose which record to display

Dim x As Variant
Dim rng As Range

On Error Resume Next
x = Target.Validation.ErrorMessage

If Err.Number = 0 Then
On Error GoTo 0
Else
Call addval
End If

If Target.Row = 4 And Target.Column = 2 Then
'calculate criteria cell in case calculation mode is manual
Worksheets("summary").Range("B4").Calculate

Worksheets("raw").Range("data") _
.AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=Sheets("summary").Range("B3:B4"), _
CopyToRange:=Range("DG1:HJ1"), Unique:=False

'select the data to be transpose
Set rng = Range("DG1").CurrentRegion
rng.Copy

------ when i select all the items, the error will cause the line
below to be highlighted when i debug the code.
'transpose the data from rows to column
Range("A8").PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=True

Application.CutCopyMode = False


'get focus on the drop down list
Range("B4").Select

rng.clear

End If

End Sub


How do i solve this error? Any suggestions?

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Run Time Error 1004: Application or Object Defined Error BEEJAY Excel Programming 4 October 18th 06 04:19 PM
Run Time 1004 Error: Application or Object Difine Error BEEJAY Excel Programming 0 October 17th 06 10:45 PM
run-time error '1004': Application-defined or object-deifined error [email protected] Excel Programming 5 August 10th 05 09:39 PM
Run time error '1004': Generaol ODBC error Dwaine Horton[_3_] Excel Programming 2 April 26th 05 02:52 PM
R/T Error encounter - Posted originally to functions ng - in error Jim May Excel Programming 2 December 24th 04 10:43 PM


All times are GMT +1. The time now is 03:33 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"