error 1004

gronkette

New Member
Joined
May 5, 2012
Messages
30
I keep getting this error when I run my macro....

"Cannot change part of a merged cell"

I've checked my sheets and I have no merged cells..... is this a bogus error or does it really mean something else?
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
It could be the range you are changing is part of an Array..
I.E...
Where you highlighted A1:A10, then entered some formula and press CTRL + SHIFT + ENTER
Note, this is different from highlighting a single cell and entering a formula with CTRL + SHIFT + ENTER, then dragging down.
This is highlighting SEVERAL cells at once, entering a formula and pressing CSE..
 
Upvote 0
It works great when Size = "Large", but errors out on "Small".....that's what's so strang???


Sub DOG_SIZE()
Sheets("DATA ENTRY SHEET").Unprotect "test"
Dim sh As Variant
With Sheets("DATA ENTRY SHEET")
.AutoFilterMode = False
With .Range("A5:S47")
For Each sh In Array("Large", "Small")
.AutoFilter Field:=18, Criteria1:=sh
.Offset(1, 0).SpecialCells(xlVisible).Copy Sheets(sh).Range("K20")
Next sh
End With
.AutoFilterMode = False
End With
Sheets("DATA ENTRY SHEET").Protect "test"
End Sub
 
Upvote 0
Could this be because my data runs out and does not always fill the entire array? If so, how do I tell the array/macro to only use lines with data in them?:confused:
 
Upvote 0
Yes, when the array runs out of data the macro bombs out.... so, now I just need to know how to make the array variable in size - it changes monthly.... and I never know in advance how many lines of data I will have for each month?

thanks !
 
Upvote 0

Forum statistics

Threads
1,215,008
Messages
6,122,672
Members
449,091
Latest member
peppernaut

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top