Search : in
By :

Problem in Macro for formating error 1004.

Last answer on Jan 7, 2009 5:19:41 pm GMT Vicky, on Jan 7, 2009 3:29:26 pm GMT 
 Report this message to moderators

Hello,
All I am new in forum, I am not a programmer or any macro expert but facing a problem with our ERP software which our company is using its generates a report of purchase and sales in a excel which does not solve my problem I have to format it with the help of autofilters and paste special but it utilized too much of my time and I have to submit the reports as early as possible than I got the idea to create a macro for formating the reports but its giving me a error message of 1004 ActiveSheet.PasteSpecial I don't know what is means.

Please some body provide me some help on it here I am giving the code if possible please send me the codes.

Sub purchase()
'
' purchase Macro
' Macro recorded 6/25/2002 by Santosh
'
' Keyboard Shortcut: Ctrl+m
'
ActiveCell.Rows("1:6").EntireRow.Select
ActiveCell.Offset(5, 0).Range("A1").Activate
Selection.Delete Shift:=xlUp
ActiveCell.Offset(0, 1).Columns("A:A").EntireColumn.Select
Selection.Insert Shift:=xlToRight
Selection.Insert Shift:=xlToRight
Selection.Insert Shift:=xlToRight
Selection.Insert Shift:=xlToRight
Selection.Insert Shift:=xlToRight
Selection.Insert Shift:=xlToRight
Selection.Insert Shift:=xlToRight
Selection.Insert Shift:=xlToRight
Selection.Insert Shift:=xlToRight
Selection.Insert Shift:=xlToRight
Selection.Insert Shift:=xlToRight
Selection.Insert Shift:=xlToRight
Selection.Insert Shift:=xlToRight
Selection.Insert Shift:=xlToRight
Selection.Insert Shift:=xlToRight
Selection.Insert Shift:=xlToRight
Selection.Insert Shift:=xlToRight
Selection.Insert Shift:=xlToRight
ActiveCell.Offset(0, -1).Range("A1").Select
ActiveCell.FormulaR1C1 = "S No."
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "Date"
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "Voucher No."
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "Bill Date"
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "Bill No."
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "GRN Date"
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "GRN No."
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "Item Code"
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "Item Name"
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "Party Name"
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "Tin No."
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "Tax Code"
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 5
ActiveWindow.ScrollColumn = 6
ActiveWindow.ScrollColumn = 7
ActiveWindow.ScrollColumn = 8
ActiveWindow.ScrollColumn = 9
ActiveWindow.ScrollColumn = 10
ActiveWindow.ScrollColumn = 11
ActiveCell.Columns("A:G").EntireColumn.Select
Selection.Delete Shift:=xlToLeft
ActiveWindow.ScrollColumn = 10
ActiveWindow.ScrollColumn = 9
ActiveWindow.ScrollColumn = 8
ActiveWindow.ScrollColumn = 7
ActiveWindow.ScrollColumn = 6
ActiveWindow.ScrollColumn = 5
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
ActiveCell.Offset(1, -11).Range("A1").Select
ActiveCell.FormulaR1C1 = "=RC[11]"
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "=RC[11]"
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "=R[1]C[9]"
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "=R[1]C[9]"
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "=R[2]C[7]"
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "=R[1]C[7]"
ActiveCell.Offset(0, -1).Range("A1").Select
ActiveCell.FormulaR1C1 = "=R[1]C[7]"
ActiveCell.Offset(0, 2).Range("A1").Select
ActiveCell.FormulaR1C1 = "=R[4]C[6]"
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "=R[4]C[6]"
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "=R[1]C[5]"
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "=R[2]C[4]"
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "=R[3]C[3]"
ActiveCell.Offset(1, 0).Range("A1").Select
ActiveWindow.ScrollColumn = 6
ActiveWindow.ScrollColumn = 5
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
ActiveCell.Cells.Select
Selection.AutoFilter
ActiveCell.Offset(4, 4).Range("A1").Select
Selection.AutoFilter Field:=2, Criteria1:="="
ActiveCell.Offset(-2, -3).Range("A1:K803").Select
ActiveCell.Offset(-2, 0).Range("A1").Select
Selection.AutoFilter Field:=2
ActiveCell.Offset(1, 0).Range("A1:K1").Select
Selection.Copy
ActiveCell.Offset(-1, 0).Range("A1").Select
Selection.AutoFilter Field:=2, Criteria1:="="
ActiveCell.Offset(2, 0).Range("A1:K803").Select
ActiveSheet.PasteSpecial
Application.CutCopyMode = False
ActiveCell.Cells.Select
Selection.Copy
ActiveCell.Offset(3, 1).Range("A1").Select
Selection.AutoFilter Field:=2
ActiveCell.Cells.Select
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveCell.Offset(0, 1).Columns("A:K").EntireColumn.Select
Selection.ColumnWidth = 13.71
Selection.ColumnWidth = 17
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 5
ActiveWindow.ScrollColumn = 6
ActiveWindow.ScrollColumn = 7
ActiveCell.Offset(16, 9).Range("A1").Select
ActiveCell.Offset(0, -2).Columns("A:A").EntireColumn.ColumnWidth = 26.71
ActiveCell.Offset(0, -1).Columns("A:A").EntireColumn.ColumnWidth = 23.57
ActiveWindow.ScrollColumn = 6
ActiveWindow.ScrollColumn = 5
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
Selection.AutoFilter Field:=1, Criteria1:="Bill :"
ActiveCell.Offset(-14, 0).Rows("1:835").EntireRow.Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlUp
Selection.AutoFilter Field:=1, Criteria1:="D.N. :"
Selection.Delete Shift:=xlUp
Selection.AutoFilter Field:=1, Criteria1:="Items :"
Selection.Delete Shift:=xlUp
Selection.AutoFilter Field:=1, Criteria1:="Order :"
Selection.Delete Shift:=xlUp
Selection.AutoFilter Field:=1
ActiveCell.Offset(0, 14).Range("A1").Select
Selection.AutoFilter Field:=15, Criteria1:="<>Voucher Totals", Operator:= _
xlAnd
ActiveWindow.ScrollColumn = 10
ActiveWindow.ScrollColumn = 9
ActiveWindow.ScrollColumn = 8
ActiveWindow.ScrollColumn = 7
ActiveWindow.ScrollColumn = 6
ActiveWindow.ScrollColumn = 5
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
Selection.AutoFilter Field:=1, Criteria1:="="
ActiveCell.Offset(2, 0).Rows("1:403").EntireRow.Select
Selection.Delete Shift:=xlUp
Selection.AutoFilter Field:=1
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 5
ActiveWindow.ScrollColumn = 6
ActiveWindow.ScrollColumn = 7
ActiveWindow.ScrollColumn = 8
ActiveWindow.ScrollColumn = 9
ActiveWindow.ScrollColumn = 10
ActiveWindow.ScrollColumn = 11
Selection.AutoFilter Field:=15
ActiveCell.Offset(-3, 14).Range("A1").Select
Selection.AutoFilter Field:=15, Criteria1:="<>Voucher Totals", Operator:= _
xlAnd
ActiveCell.Range("A1:A233").Select
Selection.ClearContents
Selection.AutoFilter Field:=15
ActiveCell.Range("A1:P1").Select
Selection.Delete Shift:=xlUp
ActiveCell.Offset(8, 0).Range("A1").Select
Selection.AutoFilter Field:=15, Criteria1:="="
ActiveCell.Offset(-7, 0).Rows("1:302").EntireRow.Select
ActiveCell.Offset(-7, -4).Range("A1").Activate
Selection.Delete Shift:=xlUp
Selection.AutoFilter Field:=15
ActiveWindow.ScrollColumn = 10
ActiveWindow.ScrollColumn = 9
ActiveWindow.ScrollColumn = 8
ActiveWindow.ScrollColumn = 7
ActiveWindow.ScrollColumn = 6
ActiveWindow.ScrollColumn = 5
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 5
ActiveWindow.ScrollColumn = 6
ActiveWindow.ScrollColumn = 7
ActiveWindow.ScrollColumn = 8
ActiveWindow.ScrollColumn = 9
ActiveWindow.ScrollColumn = 10
ActiveWindow.ScrollColumn = 11
ActiveWindow.ScrollColumn = 12
ActiveWindow.ScrollColumn = 13
ActiveWindow.ScrollColumn = 14
ActiveWindow.ScrollColumn = 15
ActiveWindow.ScrollColumn = 16
ActiveWindow.ScrollColumn = 17
ActiveWindow.ScrollColumn = 16
ActiveWindow.ScrollColumn = 15
ActiveWindow.ScrollColumn = 14
ActiveWindow.ScrollColumn = 13
ActiveWindow.ScrollColumn = 12
ActiveWindow.ScrollColumn = 11
ActiveWindow.ScrollColumn = 10
ActiveWindow.ScrollColumn = 9
ActiveWindow.ScrollColumn = 8
ActiveWindow.ScrollColumn = 7
ActiveWindow.ScrollColumn = 6
ActiveWindow.ScrollColumn = 5
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
ActiveCell.Cells.Select
Selection.Font.Bold = False
ActiveCell.Rows("1:1").EntireRow.Select
Selection.Font.Bold = True
ActiveCell.Offset(1, 0).Range("A1:A311").Select
Selection.ClearContents
ActiveCell.Select
ActiveCell.FormulaR1C1 = "1"
ActiveCell.Offset(1, 0).Range("A1").Select
ActiveCell.FormulaR1C1 = "2"
ActiveCell.Offset(-1, 0).Range("A1:A2").Select
Selection.AutoFill Destination:=ActiveCell.Range("A1:A108"), Type:= _
xlFillDefault
ActiveCell.Range("A1:A108").Select
ActiveWindow.ScrollRow = 100
ActiveWindow.ScrollRow = 95
ActiveWindow.ScrollRow = 89
ActiveWindow.ScrollRow = 81
ActiveWindow.ScrollRow = 71
ActiveWindow.ScrollRow = 60
ActiveWindow.ScrollRow = 51
ActiveWindow.ScrollRow = 39
ActiveWindow.ScrollRow = 31
ActiveWindow.ScrollRow = 22
ActiveWindow.ScrollRow = 15
ActiveWindow.ScrollRow = 9
ActiveWindow.ScrollRow = 4
ActiveWindow.ScrollRow = 1
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 5
ActiveWindow.ScrollColumn = 6
ActiveWindow.ScrollColumn = 7
ActiveCell.Offset(0, 8).Columns("A:A").EntireColumn.EntireColumn.AutoFit
ActiveCell.Offset(0, 9).Columns("A:A").EntireColumn.EntireColumn.AutoFit
ActiveWindow.SmallScroll ToRight:=3
ActiveCell.Offset(0, 10).Columns("A:A").EntireColumn.EntireColumn.AutoFit
ActiveCell.Offset(0, 11).Columns("A:A").EntireColumn.EntireColumn.AutoFit
ActiveWindow.ScrollColumn = 11
ActiveWindow.ScrollColumn = 12
ActiveWindow.ScrollColumn = 13
ActiveWindow.ScrollColumn = 14
ActiveWindow.ScrollColumn = 15
ActiveWindow.ScrollColumn = 16
ActiveCell.Offset(0, 23).Columns("A:A").EntireColumn.Select
Selection.Insert Shift:=xlToRight
ActiveCell.Select
ActiveCell.FormulaR1C1 = "Taxable Amount"
ActiveCell.Offset(0, -5).Columns("A:M").EntireColumn.Select
Selection.Style = "Comma"
ActiveWindow.ScrollColumn = 15
ActiveWindow.ScrollColumn = 14
ActiveWindow.ScrollColumn = 13
ActiveWindow.ScrollColumn = 12
ActiveWindow.ScrollColumn = 11
ActiveWindow.ScrollColumn = 10
ActiveWindow.ScrollColumn = 9
ActiveWindow.ScrollColumn = 8
ActiveWindow.ScrollColumn = 7
ActiveWindow.ScrollColumn = 6
ActiveWindow.ScrollColumn = 5
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
ActiveCell.Offset(0, -18).Range("A1").Select
End Sub

with best wishes
Thanks
Vicky

Configuration: Windows XP
Firefox 2.0.0.17

Best answers for « Problem in Macro for formating error 1004. » in :
Online forms - Errors handling ShowOnline forms - Errors handling Some things to keep in mind What you should do Although attention is given to the design of forms, any risk of error can not be ruled out. For this reason, mechanisms for error handling must be...
[Ubuntu]Repair file system error Show[Ubuntu]Repair file system error In the case that you have installed Ubuntu Linux on your PC and on the partition /dev/sdaX. If it happened that the file system is damaged , it is possible to repair it. Boot with the installation CD...
Disc error on MP4 player ShowDisc error on MP4 player After disconnected then reconnected your MP4 player to the USB port of a PC, the player displays "disc error" or "Device switching failed reconnect device please" when you put it on Music, Amv, Record, Voice,...
Download HP USB Disk Storage Format Tool ShowHP USB Disk Storage Format Tool is a small utility allowing to format a key USB or READER MP4. It also allows to make a key (Bootable). This software works with all keys and readers MP4 of the market. To make work this utility under Windows...
Download Codec pack all in one ShowCodec Pack All-In-One is a codec collection allowing to read films in DivX format and the similar formats (DivX, XviD, AC3, etc.). Codec Pack All in 1 6.0.3.0 contains: · DivX 6.1.1 · XviD Codec 1.1 · DivX, XviD - FFDShow 17.02.2005 Alpha...
MKV format (Matroska Video) ShowMKV format The MKV format (Matroska Video) is an entirely free video format. More precisely, it is a container (hence the name Matroska, in reference to the Russian dolls contained within another) making it possible to contain video (DivX, Xvid,...
Formatting - Formatting a hard drive ShowBefore trying to understand formatting, you first need to understand how a hard drive works. Many people do not distinguish low-level formatting (also called physical formatting) from high-level formatting (also called logical formatting). Even...
Error checking ShowError checking Binary encoding is very practical for use in electronic devices such as computers, in which information can be encoded based on whether an electrical signal is present or not. However, this electrical signal may suffer disturbances...

1

 phdhopes, on Jan 7, 2009 5:19:41 pm GMT

Hi,

I think that you application has been configurated to read specif language.


When using paste special you must select - whether text or numbers.

Reply to phdhopes