Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Runtime 1004

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


For iCol = iLow To iHigh
ActiveWorkbook.Sheets("Main").Range(Cells(iReadyRo w, 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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Runtime 1004

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(iReadyRo w, iLow), _
Cells(iReadyRow, iHigh)).Value = "No"
End Sub

--
HTH...

Jim Thomlinson


"Len B" wrote:

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


For iCol = iLow To iHigh
ActiveWorkbook.Sheets("Main").Range(Cells(iReadyRo w, 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Runtime 1004

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

"Jim Thomlinson" wrote in message
...
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(iReadyRo w, iLow), _
Cells(iReadyRow, iHigh)).Value = "No"
End Sub

--
HTH...

Jim Thomlinson


"Len B" wrote:

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


For iCol = iLow To iHigh
ActiveWorkbook.Sheets("Main").Range(Cells(iReadyRo w, 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





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
runtime 1004 on save as RANDY IN NC[_5_] Excel Programming 6 February 6th 06 10:40 PM
Runtime Error 1004 Lizz45ie[_10_] Excel Programming 4 November 8th 05 10:51 PM
What causes runtime error 1004? [email protected] Excel Discussion (Misc queries) 4 October 27th 05 07:15 PM
Runtime Error '1004' Dean[_4_] Excel Programming 2 January 9th 05 09:02 PM
Runtime error '1004': Capinvest Excel Programming 2 August 4th 03 07:16 PM


All times are GMT +1. The time now is 02:22 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"