View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson[_4_] Jim Thomlinson[_4_] is offline
external usenet poster
 
Posts: 1,119
Default Selecting a Range from an Offset for deletion - Help please

You need to add

Sheets("Detail").Select

prior to doing anything on that sheet. So add that line just prior to

Sheets("Detail").Range("VarInput").Offset((RowValu e - 12) * 500, _
TradeAttribute).Select

--
HTH...

Jim Thomlinson


"MichaelC" wrote:

I have the following code in my macro but get a RunTime error 1004 where
indicated.
I would much appreciate guidance on how to rectify this. Thanks in advance.
Sub Test()
Dim RowValue As Integer
Dim ColumnValue As Integer
Dim TradeAttribute As Integer

'ActiveCell is on Sheets("Control")
RowValue = ActiveCell.Row
ColumnValue = ActiveCell.Column
TradeAttribute = Sheets("Control").Cells(11, ColumnValue)

'When I run the macro I get Run Time error 1004:Select method of Range Class
failed
' and the line of code below is highlighted.
Sheets("Detail").Range("VarInput").Offset((RowValu e - 12) * 500,
TradeAttribute).Select
'I want to select a range of 497 cells below the cell selected on
Sheets("Detail") for deletion
Range("A1:A497").Select
Selection.ClearContents
End Sub