Run-time error '1004' on Range.Activate
Your code is behind a worksheet, right?
These two lines would work ok if you were in a general module, but fail behind
the worksheet:
Sheets("Bid list").Activate
Range("E2").Activate
The unqualified range ("range("e2").activate") line refers to the sheet that
contains the code. And since "Bid list" is now active, you're trying to
activate a cell on a sheet that isn't active.
You could do:
sheets("bid list").activate
sheets("bid list").range("e2").activate
Or
with sheets("bid list")
.activate
.range("e2").activate
....
end with
Don Rouse wrote:
I am getting a run-time error '1004' on a simple activate statement.
I looked at all the postings concerning '1004' and tried the suggestions
that might apply. I also tried Range.Select. But the problem persists.
Your assistance is appreciated.
The code is as follows.
Option Explicit
Dim BlankCells
Private Sub cmdMove_Click()
Sheets("Weekly List").Activate
Range("K1").Select
BlankCells = 0
Do Until BlankCells = 10
ActiveCell.Offset(1, 0).Activate
If ActiveCell 0 And IsNumeric(ActiveCell) Then
Sheets("Bid list").Activate
Range("E2").Activate 'This is where the error
occurrs
ActiveCell.End(xlDown).Offset(1, -4).Activate
Sheets("Weekly List").Activate
Rows(ActiveCell.Row).Copy
Sheets("Bid list").Activate
ActiveSheet.PasteSpecial
Sheets("Weekly List").Activate
Rows(ActiveCell.Row).Delete
BlankCells = 0
ElseIf ActiveCell = "" Then
BlankCells = BlankCells + 1
End If
Loop
Sheets("Bid list").Activate
Range("A1").Select
Sheets("Weekly List").Activate
Range("A1").Select
End Sub
--
Don
--
Dave Peterson
|