Hello all,
Merry Christmas and Happy New years!
I am having an issue with VBA Scripting. This is what I've done:
Sub Create_Dynamic_Forecast()
'
' Create_Dynamic_Forecast
Application.ScreenUpdating = True
'ActiveWorkbook.Save
Sheets.Add After:=Sheets(Sheets.Count)
ActiveSheet.Name = "Dynamic Forecast"
Sheets("Emergency Proforma").Select
Cells.Select
Range("B1").Activate
Selection.Copy
Sheets("Dynamic Forecast").Select
ActiveSheet.Paste
ActiveWindow.DisplayGridlines = False
ActiveSheet.Shapes("Button 1").Select
Application.CutCopyMode = False
Selection.Delete
Application.CutCopyMode = False
Range("C31").Select
Selection.ClearContents
Range("D2:K2").Select
ActiveCell.FormulaR1C1 = "30 Day Dynamic Forecast"
Application.ScreenUpdating = True
MsgBox ("Dynamic Forecast saved to C:\Temp")
End Sub
It's working until Range("C31").Select and then it bombs out with:
"Run-time error '1004': Application-defined or object-defined error"
I understand that the error relates to forms, controls, and so on but not why its happening. I just want to clear the contents of the cell on the new sheet.
Believe it or not, i'm not very good at VBA!
Merry Christmas and Happy New years!
I am having an issue with VBA Scripting. This is what I've done:
Sub Create_Dynamic_Forecast()
'
' Create_Dynamic_Forecast
Application.ScreenUpdating = True
'ActiveWorkbook.Save
Sheets.Add After:=Sheets(Sheets.Count)
ActiveSheet.Name = "Dynamic Forecast"
Sheets("Emergency Proforma").Select
Cells.Select
Range("B1").Activate
Selection.Copy
Sheets("Dynamic Forecast").Select
ActiveSheet.Paste
ActiveWindow.DisplayGridlines = False
ActiveSheet.Shapes("Button 1").Select
Application.CutCopyMode = False
Selection.Delete
Application.CutCopyMode = False
Range("C31").Select
Selection.ClearContents
Range("D2:K2").Select
ActiveCell.FormulaR1C1 = "30 Day Dynamic Forecast"
Application.ScreenUpdating = True
MsgBox ("Dynamic Forecast saved to C:\Temp")
End Sub
It's working until Range("C31").Select and then it bombs out with:
"Run-time error '1004': Application-defined or object-defined error"
I understand that the error relates to forms, controls, and so on but not why its happening. I just want to clear the contents of the cell on the new sheet.
Believe it or not, i'm not very good at VBA!
