View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
blackbox via OfficeKB.com blackbox via OfficeKB.com is offline
external usenet poster
 
Posts: 59
Default Copy range to / from CSV file

I tried to record a macro copying from the CSV and pasting to the xls but got
an error message

run-time error '1004':
Paste method of Worksheet class failed

This is the code generated

Sub import()
'
' import Macro
' Macro recorded 6/14/2007 by Administrator
'

'
Range("E2").Select
ActiveSheet.Paste
End Sub

I also tried a drag and drop without any luck

NickHK wrote:
Start by recording a macro whilst perform those actions.
This will give you the basic code.

If the filenames remain constant, that will work.
If they change each day, check the help for GetOpenFileName and incorporate
it into your code.

NickHK

I receive a CSV file each morning and have to copy range E2:E22 and copy it
to a XLS sheet (calculator) range H2:H22 then copy I2:I22 form the XLS sheet

[quoted text clipped - 4 lines]

Any help would be appreciated.


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200706/1