Runtime 1004

  • Thread starter Thread starter Len B
  • Start date Start date
L

Len B

I have tried this a couple of ways and both give error 1004
For iCo l = iLow To iHigh
ActiveWorkbook.Sheets("Main").Range(Cells(iReadyRow, iCol)).Value = "No"
Next


For iCol = iLow To iHigh
ActiveWorkbook.Sheets("Main").Range(Cells(iReadyRow, iCol)).Select
Selection.Value = "No"
Next

Both fail on the ActiveWorkbook line. Any idea what I am doing wrong?

And - maybe there is a more elegant way to reset a range to a value other
than cell by cell. I guess I could have a range of the same size hidden
somewhere with "No" in every cell and just copy it over the top.

TIA
-- Len
 
This works for me...

Sub test()
Dim iReadyRow As Long
Dim iLow As Integer
Dim iHigh As Integer

iReadyRow = 2
iLow = 3
iHigh = 10

ActiveWorkbook.Sheets("Main").Range(Cells(iReadyRow, iLow), _
Cells(iReadyRow, iHigh)).Value = "No"
End Sub
 
Hi Jim,
Thanks for such a quick response.

I'm the dummy, aren't I?
But if I need to blame someone, I'll blame Intellisense. It didn't remind me
that Range has 2 parameters, not one (but it is NOW).
It just looked right because range end same as range begin.
Thanks
-- Len
 

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

Back
Top