Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Macro to paste error

I am trying to get a macro to work, but quite surprisingly what I
thought would have been the simplest part of the code just doesn't
want to work. I wrote a macro that
1. Selects a sheet in the workbook
2. Selects a range of cells and copies them (simple text, no formulae)
3. Opens an existing workbook
4. Creates a new sheet naming it with the current date

At this point it should paste the data in the clipboard onto the new
sheet, but instead I get this annoying "Runtime error 438 - Property
or method not supported by object" message, followed by the yellow
line of death over the last line of my code. I am quite new to VB, and
am a bit lost. Can anybody help?
Thank you for any suggestions.

Here's my code

Sub Copy_to_fix

Dim fix
fix = "G:\AREA GRUPPO...\3-5 fix.xls"
Sheets("last settori").Select
ActiveWorkbook.ActiveSheet.Range("B1:AU1200").Copy
Workbooks.Open filetoopen
Windows("3-5 fix.xls").Activate
ActiveWindow.WindowState = xlMaximized
Sheets.Add.Move after:=Sheets(Sheets.Count)
Sheets("Foglio1").Name = Format(Date, "DD MMM YY")
ActiveCell.Paste ***YELLOW LINE OF DEATH***

End sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Macro to paste error

Derek, thanks a lot for your help, though I had already thought of
that solution, but unfortunately it wasn't that. I would get another
problem message with something slightly different (something like
"procedure not valid for this option".
I anyway managed to work my way around it. I had the macro copy and
paste after it had opened the workbook and create the new sheet.
Apparently it must have been losing the clipboard data somewhere in
the process. Macro is slightly longer (there's a couple of workbook
activate and sheets.select more), but it is not working brillantly.
Thank you very much anyway!!!
Lorenzo
Reply
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
I tried to get around the problem of the pivot table field settingdefaulting to Count instead of Sum by running a macro of change the settingfrom Count to Sum. However, when I tried to run the Macro, I got error messageof run time error 1004, unable Enda80 Excel Worksheet Functions 1 May 3rd 08 02:35 PM
Paste method error in macro bwilk77 Excel Discussion (Misc queries) 2 October 25th 07 09:21 PM
error when running cut & paste macro Otto Moehrbach Excel Worksheet Functions 4 August 9th 06 01:49 PM
error running a paste macro Redskinsfan Excel Worksheet Functions 1 August 7th 06 08:02 PM
Macro to paste error Lorenzo Excel Programming 0 July 24th 03 08:32 PM


All times are GMT +1. The time now is 12:06 AM.

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

About Us

"It's about Microsoft Excel"