run time error 1004

  • Thread starter brownti via OfficeKB.com
  • Start date
B

brownti via OfficeKB.com

Any one know what this could mean?
here is the code the produces it:
Sub o_three_panel_tot()
Application.ScreenUpdating = False
Sheets("o-bid").Select
Range("o_oak_slab_tot").Select
ActiveCell.FormulaR1C1 = "=SUM(o_threep_oak_slab)"
Range("o_raw_slab_tot").Select
ActiveCell.FormulaR1C1 = "=sum(o_threep_raw_slab)"
Range("o_maple_slab_tot").Select
ActiveCell.FormulaR1C1 = "=sum(o_threep_maple_slab)"
Range("o_pine_slab_tot").Select
ActiveCell.FormulaR1C1 = "=sum(o_threep_pine_slab)"
Range("o_alder_slab_tot").Select
ActiveCell.FormulaR1C1 = "=sum(o_threep_alder_slab)"
Range("o_cherry_slab_tot").Select
ActiveCell.FormulaR1C1 = "=sum(o_threep_cherry_slab)"
Sheets("o-builder").Select
End Sub
 
D

Don Guillett

TYPO?

What do your named ranges refer to? Individual cells or ranges? Also you do
NOT need or want selections.
with sheets("o-bid")
.Range("o_oak_slab_tot").Formula= "=SUM(o_threep_oak_slab)"
.Range("o_raw_slab_tot").Formula= "=sum(o_threep_raw_slab)"
'etc notice the . before range
end with

or, since they are named ranges, you may be able to just use this without
the With and no dots
sub doit()
Range("o_oak_slab_tot").Formula= "=SUM(o_threep_oak_slab)"
Range("o_raw_slab_tot").Formula= "=sum(o_threep_raw_slab)"
'etc
end sub
 
B

brownti via OfficeKB.com

the named ranges refer to a merged cell...i tried both things below and got
the same error. i first thought typo too, but cant seem to locate a typo.
I'll keep checking though. Well i tried moving the code to a different mod
and it works from there. i dont understand, but it works, so i'll leave it.
thanks,


Don said:
TYPO?

What do your named ranges refer to? Individual cells or ranges? Also you do
NOT need or want selections.
with sheets("o-bid")
.Range("o_oak_slab_tot").Formula= "=SUM(o_threep_oak_slab)"
.Range("o_raw_slab_tot").Formula= "=sum(o_threep_raw_slab)"
'etc notice the . before range
end with

or, since they are named ranges, you may be able to just use this without
the With and no dots
sub doit()
Range("o_oak_slab_tot").Formula= "=SUM(o_threep_oak_slab)"
Range("o_raw_slab_tot").Formula= "=sum(o_threep_raw_slab)"
'etc
end sub
Any one know what this could mean?
here is the code the produces it:
[quoted text clipped - 15 lines]
Sheets("o-builder").Select
End Sub
 
D

Don Guillett

You should still learn how to clean it up

--
Don Guillett
SalesAid Software
[email protected]
brownti via OfficeKB.com said:
the named ranges refer to a merged cell...i tried both things below and
got
the same error. i first thought typo too, but cant seem to locate a typo.
I'll keep checking though. Well i tried moving the code to a different
mod
and it works from there. i dont understand, but it works, so i'll leave
it.
thanks,


Don said:
TYPO?

What do your named ranges refer to? Individual cells or ranges? Also you
do
NOT need or want selections.
with sheets("o-bid")
.Range("o_oak_slab_tot").Formula= "=SUM(o_threep_oak_slab)"
.Range("o_raw_slab_tot").Formula= "=sum(o_threep_raw_slab)"
'etc notice the . before range
end with

or, since they are named ranges, you may be able to just use this without
the With and no dots
sub doit()
Range("o_oak_slab_tot").Formula= "=SUM(o_threep_oak_slab)"
Range("o_raw_slab_tot").Formula= "=sum(o_threep_raw_slab)"
'etc
end sub
Any one know what this could mean?
here is the code the produces it:
[quoted text clipped - 15 lines]
Sheets("o-builder").Select
End Sub
 
B

brownti via OfficeKB.com

i know i should... :-/ I dont know where to begin to clean it up, and since
its working, I'm happy for the time being.


Don said:
You should still learn how to clean it up
the named ranges refer to a merged cell...i tried both things below and
got
[quoted text clipped - 29 lines]
 
D

Don Guillett

Look at my first post which gets rid of the selections.

--
Don Guillett
SalesAid Software
[email protected]
brownti via OfficeKB.com said:
i know i should... :-/ I dont know where to begin to clean it up, and since
its working, I'm happy for the time being.


Don said:
You should still learn how to clean it up
the named ranges refer to a merged cell...i tried both things below and
got
[quoted text clipped - 29 lines]
Sheets("o-builder").Select
End Sub
 
Top