LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,049
Default Sheets(s).Range("A4:A19").Select error

(1) s after next is redundant, and (2) you can't select a range if the sheet
that the range is on isn't active, but in this case, it doesn't need to be.
Here's the amended code for you:

For s = 2 To ActiveWorkbook.Sheets.Count
If Sheets(s).Range("A50").Value = 3 Then
Sheets(s).Range("A4:A19").NumberFormat = "0.00%"
End If
Next

"Fan924" wrote in message
...
I am looping through sheets "s" 2 to 20

For s = 2 To ActiveWorkbook.Sheets.Count
If Sheets(s).Range("A50").Value = 3 Then
Sheets(s).Range("A4:A19").Select
Selection.NumberFormat = "0.00%"
End If
Next s

This works fine ... Sheets(s).Range("A50").Value

Sheets(s).Range("A4:A19").Select.... When I change .Select to.Value ,
I get an error. What can I use as an alternate?


 
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
"Select method of Range class failed" Error Ayo Excel Discussion (Misc queries) 3 September 2nd 08 07:58 PM
"run-time error '1004' - select method of range failed" maemi weirdoke Excel Programming 2 March 5th 08 03:15 PM
VBA error 1004 "Select method of Range class failed" Matt J Excel Programming 6 July 3rd 04 10:05 PM
Error 1004, "select method of range class failed" paritoshmehta[_11_] Excel Programming 3 May 6th 04 10:09 PM
Runtime Error "1004" Select Method of Range Class Failed Stephen[_7_] Excel Programming 4 April 10th 04 06:28 AM


All times are GMT +1. The time now is 04:06 PM.

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

About Us

"It's about Microsoft Excel"