View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.newusers
franco monte franco monte is offline
external usenet poster
 
Posts: 10
Default VBA copy cell to another worksheet

Hello, I am trying to copy text information from one worksheet to
another.
I open only the first sheet then I have a comand button by where I
want to say transfer the values.

La macro give an error at ObjWorshett.Cells(Riga, 1).text =
oDO.GetText
Errore di run-time '1004'.
Errore definito dall'applicazione o dall'oggetto.
Thanks in advance!
Franco



Dim oDO As New DataObject
oDO.SetText [B2].Value
oDO.PutInClipboard

Dim ObjWorshett As Worksheet
Dim strNomeFile As String

strNomeFile = "\\srv01\Dp\ANTONELLA\sblocco.xls"
Set ObjWorshett = Application.Workbooks.Open(strNomeFile, False,
True).Sheets(1)
UltimaRiga = ObjWorshett.Range("A65356").End(xlUp).Row
Riga = UltimaRiga + 1

oDO.GetFromClipboard
ObjWorshett.Cells(Riga, 1).text = oDO.GetText
Set oDO = Nothing

ObjWorshett.Application.ActiveWorkbook.Close