1

Run-time error '1004' Method 'Range' of object '_Global' failed

I am getting above error as soon as I execute below sequence. My objective here is to delete content of all cells falling in range of current cell till C200.

Posit2.Select
Sheets("Sheet1").Cells(53, 1).Value = ActiveCell.Address      ' $C$52 is output
Range(ActiveCell.Address, c200).ClearContents

3 Answers 3

1

Your line is wrong,

Range(ActiveCell.Address & " : C200").ClearContents

Is right

Sign up to request clarification or add additional context in comments.

Comments

0

You can also try replacing your error line to:

Range(ActiveCell, Cells(200, "C")).ClearContents

Comments

0

Eventually you will want to move away from selecting. Assuming Posit2 is a reference to C52 on Sheet1 in your example then

Dim Posit2 as Range

set Posit2 = Worksheets("Sheet1").range("C52")

With Posit2.parent
  .Range(Posit2, .Cells(200,"C")).ClearContents
End With

First two lines are for illustration as you should already have code that does that. Also, by referencing the sheet, Sheet1 would not need to be the activesheet.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.