Error In Excel 2003 -"Runtime Error 1004: Select method of Range class failed"

Joined
Aug 22, 2007
Messages
2
Reaction score
0
Hi all,

Im getting a strange error when creating a macro in excel 2003, The macro's were recorded seperately and worked correctly, but when they have been merged together and assigned to a button I get the following error:

"Runtime Error 1004: Select method of Range class failed"

The code is as follows:

"Private Sub CommandButton8_Click()
'Macro 1
Sheets("Sheet1").Select
Range("M16").Select
ActiveCell.FormulaR1C1 = "=RC[-1]+RC[1]"
Range("M16").Select
Selection.Copy
Range("K16").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("M19").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = ""
Range("L23").Select

'macro 2

Sheets("Sheet1").Select
Range("A1:H18").Select
Range("H18").Activate
With ActiveWorkbook.PublishObjects.Add(xlSourceRange, _
"http://mps-not-sp01/is/cepoint/Daily Stats/BusDevStatsandTracker.htm", _
"Sheet1", "$A$1:$H$18", xlHtmlStatic, "Daily Stats Template (with macro)_12193" _
, "")
.Publish (True)
.AutoRepublish = False
End With

'macro 3

Sheets("Sheet4").Select
Range("A1:H19").Select
Range("H19").Activate
With ActiveWorkbook.PublishObjects("Daily Stats Template (with macro)_27217")
.HtmlType = xlHtmlStatic
.Filename = "http://mps-not-sp01/is/cepoint/Daily Stats/TableandGraph.htm"
.Publish (False)
.AutoRepublish = False
End With

Sheets("Sheet2").Select
Range("B22").Select

End Sub"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top