Advertisement

There's no such thing as a stupid question, but they're the easiest to answer.
Login
Search

Advertisement

Business Applications Business Applications
Search Search
Search for:
Tech Support Guy > > >

Run-time error "1004": Cannot use that command on overlapping selections.


(!)

sahancock's Avatar
sahancock sahancock is offline
Junior Member with 2 posts.
THREAD STARTER
 
Join Date: Nov 2010
16-Nov-2010, 12:30 AM #1
Red face Run-time error "1004": Cannot use that command on overlapping selections.
When I recorded this macro it worked, however, when I later attempt to use the macro on the same data I get the above error. Why?

Columns("A:A").Select
Selection.SpecialCells(xlCellTypeBlanks).Select
Selection.EntireRow.Delete (This is highlighted when attempting to Debug).
Columns("B:B").Select
Selection.SpecialCells(xlCellTypeBlanks).Select
Selection.EntireRow.Delete
Range("A:A,C:C,D,E:E,F:F,G:G").Select
Range("G1").Activate
Selection.Delete Shift:=xlToLeft
Range("G9").Select


Thank you in advance for any assistance.
turbodante's Avatar
turbodante turbodante is offline
Senior Member with 744 posts.
 
Join Date: Dec 2008
Location: GMT UK
16-Nov-2010, 06:50 AM #2
Your code works fine for me at the point where you state there's a problem, but for an apostrophie character to comment out your notes.

Code:
 Selection.EntireRow.Delete '[put in apostrophie sysmbol to comment](This is highlighted when attempting to Debug).
It may be that you do not have any blank cells in column A, or that the whole of column A is blank.

Can you explain more.

Welcome to the forum btw.
sahancock's Avatar
sahancock sahancock is offline
Junior Member with 2 posts.
THREAD STARTER
 
Join Date: Nov 2010
17-Nov-2010, 12:34 AM #3
Thanks for the "Welcome".

I figured out how to get it to work, although I don't quite understand why it was a problem.

My A and B columns had some "wrapped text". After reformating, the macro worked. The thing I don't understand is why when I was recording the macro I didn't have any problems with the "wrapped text", but in running it I did. ???

ps. Are you an Excel/VBA "geek"? I am just starting to use macro's and I love them. I wish I knew how to actually write the code. It's so much fun.
turbodante's Avatar
turbodante turbodante is offline
Senior Member with 744 posts.
 
Join Date: Dec 2008
Location: GMT UK
17-Nov-2010, 04:21 AM #4
Quote:
Originally Posted by sahancock View Post
...
My A and B columns had some "wrapped text". After reformating, the macro worked. The thing I don't understand is why when I was recording the macro I didn't have any problems with the "wrapped text", but in running it I did. ???
Wrapped text should'nt be a problem; but if you mean merged cells - then that could present you with a problem. Personally, I'd avoid merging cells in worksheets. To get round this, perhaps you could use...

Code:
 
Range("A1").EntireColumn.SpecialCells(xlCellTypeBlanks).Select
Selection.EntireRow.Delete
But, if possible do not use merged cells to avoid unnecessary pain and suffering .

Quote:
ps. Are you an Excel/VBA "geek"? I am just starting to use macro's and I love them. I wish I knew how to actually write the code. It's so much fun.
I must admit to gaining a bizarre joy by assisting others with their Excel woes here on this forum – I see it as being productive whist not being productive in my own work! I think you’ll find that this forum is crawling with VBA whizzes; so if you hang around, like I did, you’d soon pick it up.
As Seen On

BBC, Reader's Digest, PC Magazine, Today Show, Money Magazine
WELCOME TO TECH SUPPORT GUY!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.


(clock)
THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Similar Threads
Title Thread Starter Forum Replies Last Post
Solved: Run-time error 75 Ry-Mysterio69 All Other Software 9 11-Aug-2009 06:41 AM
Picture It, Run Time Error elzo dibbets Digital Photography & Imaging 2 03-Jan-2009 09:10 AM
Windows Live messenger errors 8000ffff cannot use sharing folder or remote assistance ShadowChaos Web & Email 0 03-Nov-2008 06:04 PM
Run Time Error 20599 Cannot Open Sql Server? cjames007 Windows XP 0 04-Oct-2007 09:24 AM
run time error 91 while using IE larryc Web & Email 8 05-Sep-2003 08:34 PM

WELCOME
You Are Using: Server ID
Trusted Website Back to the Top ↑

Content Relevant URLs by vBSEO 3.3.2