Compile error

K

KevHardy

I'm using this vba to copy/delete a row of data from "Allocations" to
"Outcomes":

Private Sub MoveToOutcomes_Click()
If Selection.Rows.Count > 1 Then Exit Sub
Set sht = Sheets("Outcomes")
lastrow = sht.Cells(Cells.Rows.Count, "A").End(xlUp).Row
ActiveCell.EntireRow.Copy _
Destination:=sht.Range("A" & lastrow + 1)
ActiveCell.EntireRow.Delete

End Sub

This code had been working perfectly until today but I'm now getting a
"Compile error - Can't find project or library" message.
I haven't made any changes to the workbook so I'm not sure what I've done
wrong?

Any ideas?
 
M

Mike H

Hi,

ALT+F11 to open VB editor then

Tools - References and ensure the 'Microsoft Office nn.0 object library' is
checked.
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.
 

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