"Run-time error '1004'" pastespecial method of Range class failed

teoyildiz

New Member
Joined
Feb 28, 2014
Messages
2
I am not facing an error with this code on my computer but when i try yo work on another one with same hardware and excel version (2010 proffesional), it gives this error "runtime error 1004 worksheet class pastespecial failed". I am new and i will use this code my mini-project, thank you for your understanding

Code:
[COLOR=#000000][FONT=Consolas] 
Sheets[/FONT][/COLOR][COLOR=#000000][FONT=Consolas]([/FONT][/COLOR][COLOR=#800000][FONT=Consolas]"STForm"[/FONT][/COLOR][COLOR=#000000][FONT=Consolas]).[/FONT][/COLOR][COLOR=#000000][FONT=Consolas]PasteSpecial Format[/FONT][/COLOR][COLOR=#000000][FONT=Consolas]:=[/FONT][/COLOR][COLOR=#800000][FONT=Consolas]"Unicode Text"[/FONT][/COLOR][COLOR=#000000][FONT=Consolas],[/FONT][/COLOR][COLOR=#000000][FONT=Consolas] Link[/FONT][/COLOR][COLOR=#000000][FONT=Consolas]:=[/FONT][/COLOR][COLOR=#800000][FONT=Consolas]False[/FONT][/COLOR][COLOR=#000000][FONT=Consolas],[/FONT][/COLOR][COLOR=#000000][FONT=Consolas] _[/FONT][/COLOR]
[COLOR=#000000][FONT=Consolas]DisplayAsIcon[/FONT][/COLOR][COLOR=#000000][FONT=Consolas]:=[/FONT][/COLOR][COLOR=#800000][FONT=Consolas]False[/FONT][/COLOR][COLOR=#000000][FONT=Consolas],[/FONT][/COLOR][COLOR=#000000][FONT=Consolas] NoHTMLFormatting[/FONT][/COLOR][COLOR=#000000][FONT=Consolas]:=[/FONT][/COLOR][COLOR=#800000][FONT=Consolas]True
[/FONT][/COLOR]


In this macro i am trying to get this data (long string) from clipboard and paste to column A commencing with a1 cell, everyline is copied to rows. Then with formulas, it is finding key words and taking values to desired cells with column and row numbers. Every line of data is pasted to rows perfectly on my computer. Data is copied to clipboard from internet page. There is no merged cells on sheet and there is no format.

Code:
Private Sub Yapistir_Click()Sheets("STForm").Range("A1").Activate
Dim Tn As String
Dim Tna As String
Dim Tnb As String
Dim Tnc As String
Dim Tnd As String
Dim Tne As String
Tn = Range("O9").Value
Range("I61").Value = Range(Tn).Value
Tna = Range("O12").Value
Range("E6").Value = Range(Tna).Value
Tnb = Range("O14").Value
Range("E12").Value = Range(Tnb).Value
Tnc = Range("O16").Value
Range("E13").Value = Range(Tnc).Value
Tnd = Range("O18").Value
Range("E11").Value = Range(Tnd).Value
Tne = Range("O20").Value
Range("E21").Value = Range(Tne).Value
Tnf = Range("O22").Value
Range("E24").Value = Range(Tnf).Value
If Application.CutCopyMode = xlCut Then
    MsgBox "dont cut"
Else
    Sheets("STForm").PasteSpecial Format:="Unicode Text", Link:=False, _
    DisplayAsIcon:=False, NoHTMLFormatting:=True
    Abone.Text = Sheets("STForm").Range("I12")
    Soyad.Text = Sheets("STForm").Range("I13")
    isletme.Text = Sheets("STForm").Range("K6")
    Aboneno.Text = Sheets("STForm").Range("I6")
    TCNo.Text = Sheets("STForm").Range("I11")
    Telefon.Text = Sheets("STForm").Range("I24")
    Adres.Text = Sheets("STForm").Range("I21")
    Sayacno.Text = Sheets("STForm").Range("I60")
    sayacmarka.Text = Sheets("STForm").Range("J60")


End If
End Sub


 
Last edited:

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
I believe you need to clarify the range where you want to have the data pasted :

Code:
'''If you want to paste in cell A1 :
Sheets("STForm").Range("A1").PasteSpecial Format:="Unicode Text", Link:=False, _
DisplayAsIcon:=False, NoHTMLFormatting:=True
 
Last edited:
Upvote 0
I believe you need to clarify the range where you want to have the data pasted :

Code:
'''If you want to paste in cell A1 :
Sheets("STForm").Range("A1").PasteSpecial Format:="Unicode Text", Link:=False, _
DisplayAsIcon:=False, NoHTMLFormatting:=True

Dear Drimacus,
I tried but unfortunately same error exists
 
Upvote 0

Forum statistics

Threads
1,216,177
Messages
6,129,323
Members
449,501
Latest member
Amriddin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top