Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Runtime Error "1004" Select Method of Range Class Failed

Hi -

Currently I have formatting macros attached to various Comboboxes and
Toggle Buttons. I copied one of the macros below. The problem I am
having now is when I try to insert cells on a different tab, I get the
Runtime Error 1004. When I click on debug, it highlights the selected
range of the macro (line 2 below). I can only make changes if I
disable the macros. Can this be fixed?

Application.ScreenUpdating = False
Worksheets("Roll-up by RSM").Range("D13:G17,I13:L17,D21:G25").Select
With Selection
If Worksheets("Master List").Range("CA26") = "% of Sales" Then
Selection.NumberFormat = "0.00%"
Else
Selection.NumberFormat = _
"_($* #,##0.00_);_($* (#,##0.00);_($*-??_);_(@_)"
End If
If Worksheets("Master List").Range("CA26") = "Total $" Then
Selection.NumberFormat = "_($* #,##0_);_($* (#,##0);_($*
""-""_);_(@_)"
End If
End With

Thanks in advance for your help.

Stephen
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Runtime Error "1004" Select Method of Range Class Failed

You can only select cells on the active sheet. OTOH, you don't need to
select at all:

With Worksheets("Roll-up by RSM").Range("D13:G17,I13:L17,D21:G25")
Select Case Worksheets("Master List").Range("CA26").Value
Case "% of Sales"
.NumberFormat = "0.00%"
Case "Total $"
.NumberFormat = _
"_($* #,##0_);_($* (#,##0);_($* - _);_(@_)"
Case Else
.NumberFormat = _
"_($* #,##0.00_);_($* (#,##0.00);_($*-??_);_(@_)"
End Select
End With


In article ,
(Stephen) wrote:

Hi -

Currently I have formatting macros attached to various Comboboxes and
Toggle Buttons. I copied one of the macros below. The problem I am
having now is when I try to insert cells on a different tab, I get the
Runtime Error 1004. When I click on debug, it highlights the selected
range of the macro (line 2 below). I can only make changes if I
disable the macros. Can this be fixed?

Application.ScreenUpdating = False
Worksheets("Roll-up by RSM").Range("D13:G17,I13:L17,D21:G25").Select
With Selection
If Worksheets("Master List").Range("CA26") = "% of Sales" Then
Selection.NumberFormat = "0.00%"
Else
Selection.NumberFormat = _
"_($* #,##0.00_);_($* (#,##0.00);_($*-??_);_(@_)"
End If
If Worksheets("Master List").Range("CA26") = "Total $" Then
Selection.NumberFormat = "_($* #,##0_);_($* (#,##0);_($*
""-""_);_(@_)"
End If
End With

Thanks in advance for your help.

Stephen

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Runtime Error "1004" Select Method of Range Class Failed

I tried the script below and it works. However, now when I try to
insert cells, Excel locks up. When I right click and select close on
the program, it asks if I want to save my changes. I've tried it on
different computers with the same result.

JE McGimpsey wrote in message ...
You can only select cells on the active sheet. OTOH, you don't need to
select at all:

With Worksheets("Roll-up by RSM").Range("D13:G17,I13:L17,D21:G25")
Select Case Worksheets("Master List").Range("CA26").Value
Case "% of Sales"
.NumberFormat = "0.00%"
Case "Total $"
.NumberFormat = _
"_($* #,##0_);_($* (#,##0);_($* - _);_(@_)"
Case Else
.NumberFormat = _
"_($* #,##0.00_);_($* (#,##0.00);_($*-??_);_(@_)"
End Select
End With


In article ,
(Stephen) wrote:

Hi -

Currently I have formatting macros attached to various Comboboxes and
Toggle Buttons. I copied one of the macros below. The problem I am
having now is when I try to insert cells on a different tab, I get the
Runtime Error 1004. When I click on debug, it highlights the selected
range of the macro (line 2 below). I can only make changes if I
disable the macros. Can this be fixed?

Application.ScreenUpdating = False
Worksheets("Roll-up by RSM").Range("D13:G17,I13:L17,D21:G25").Select
With Selection
If Worksheets("Master List").Range("CA26") = "% of Sales" Then
Selection.NumberFormat = "0.00%"
Else
Selection.NumberFormat = _
"_($* #,##0.00_);_($* (#,##0.00);_($*-??_);_(@_)"
End If
If Worksheets("Master List").Range("CA26") = "Total $" Then
Selection.NumberFormat = "_($* #,##0_);_($* (#,##0);_($*
""-""_);_(@_)"
End If
End With

Thanks in advance for your help.

Stephen

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Runtime Error "1004" Select Method of Range Class Failed

There's nothing inherent in the code itself that would cause XL to 'lock
up'.

Where is this code located? Can you set breakpoint(s) and step through
the code to see where the 'lockup' occurs?




In article ,
(Stephen) wrote:

I tried the script below and it works. However, now when I try to
insert cells, Excel locks up. When I right click and select close on
the program, it asks if I want to save my changes. I've tried it on
different computers with the same result.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Runtime Error "1004" Select Method of Range Class Failed

I removed "Application.ScreenUpdating = False" from the code and it
works fine now. The code was located on the sheet with the toggle
button and combo box. I'm not sure why it had an effect on the other
sheets.

THANKS FOR ALL YOUR HELP!!!


JE McGimpsey wrote in message ...
There's nothing inherent in the code itself that would cause XL to 'lock
up'.

Where is this code located? Can you set breakpoint(s) and step through
the code to see where the 'lockup' occurs?




In article ,
(Stephen) wrote:

I tried the script below and it works. However, now when I try to
insert cells, Excel locks up. When I right click and select close on
the program, it asks if I want to save my changes. I've tried it on
different computers with the same result.

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
"Select method of Range class failed" Error Ayo Excel Discussion (Misc queries) 3 September 2nd 08 07:58 PM
Runtime 1004 error -- insert method of range class failed. tish Excel Discussion (Misc queries) 1 June 1st 07 04:04 PM
Run-time error "1004" Select method of range class failed Tallan Excel Discussion (Misc queries) 3 March 7th 07 05:22 PM
runtime error '1004' delete Method of Range Class Failed Tom Ogilvy Excel Programming 0 April 1st 04 04:09 AM
excel97: runtime error 1004 select method of range class failed JMCN Excel Programming 4 December 25th 03 05:32 AM


All times are GMT +1. The time now is 12:08 PM.

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"