View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Rowan[_2_] Rowan[_2_] is offline
external usenet poster
 
Posts: 226
Default Run-time error '1004' on Range.Activate

Hi Sebastien

I have to disagree with you on this.

If you have a range selected, Say A1:C10 then you can use the activate
statement to move the activecell within the selection. So:

With ActiveSheet
.Range("A1:C10").Select
.Range("B1").Activate
End With

leaves you with Range A1:C10 selected and B1 is the activecell.

However if you use the activate statement on a cell which occurs outside the
selected range then you simply Select and Activate that cell. So:

With ActiveSheet
.Range("A1:C10").Select
.Range("F1").Activate
End With

leaves you with just cell F1 selected (and hence the active cell). I have
never seen this cause an error.

Regards
Rowan

"sebastienm" wrote:

You can only active a cell within the selected range. Therefore,if A1 is
seleected and you are activating E1, an error occurs. You could however
select A1:G10 and the activate E1 without any problem bacause E1 is within
A1:G10.

So you would have to do:
Range("E2").Select 'insert this line
Range("E2").Activate
--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"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