L
Lorenzo
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
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