Results 1 to 5 of 5

Thread: Find Merged Cells VBA

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    Forum Guru Rick Rothstein's Avatar
    Join Date
    Feb 2012
    Posts
    662
    Rep Power
    15
    Quote Originally Posted by Admin View Post
    I thought about the findformat method. But I think findformat was introduced in XL 2002/2003 (not sure which one).

    So I thought it would be better a function whch works on all versions(not sure about XL 97 though)
    I only have XL2003 and XL2007 installed, plus I only came to Excel maybe 5 years ago, so I am unaware of any limitation on versions of Excel prior to XL2003. Besides, why worry about earlier versions of Excle... everyone has moved up to at least XL2003 by now, right?

    Quote Originally Posted by Admin View Post
    Another point, if you pass a string it must be a range address, otherwise it would throw error.
    Isn't that what functions normally do when they get passed invalid arguments? I would think it is up to the programmer to either filter out improper argument values before the function is called or to handle errors generated by the function after they are produced. Did you have something different in mind for what my function should do if the passed in String value was not a range address?

    Quote Originally Posted by Admin View Post
    I did a small test on A1:K10000 with 1169 merged areas, and the average time taken is as follows:

    Ricks - 5 secs
    Mine - 7 secs
    While I would always expect my function to be faster than what you posted, the percentage difference between them is highly dependent on the number of merged cells involved. Both of our routines repeatedly use the Union function for each merged cell in the range. You test with 1169 merged cells means 1169 Union operations... the Union method gets progressively slower with each new member added to it and I think 1169 of them is enough to slow things down noticeably and, as a result, hide the true difference between our codes. What times do you get if you repeat that test with, say, 5 merged areas?
    Last edited by Rick Rothstein; 02-25-2012 at 07:12 AM.

Similar Threads

  1. Trim all Cells in a Worksheet - VBA
    By Admin in forum Excel and VBA Tips and Tricks
    Replies: 6
    Last Post: 08-21-2015, 08:22 AM
  2. Replies: 13
    Last Post: 06-10-2013, 09:05 AM
  3. VBA - Find Last End Value
    By ivandgreat in forum Excel Help
    Replies: 3
    Last Post: 05-02-2013, 10:37 AM
  4. Vba Code to find value and paste on certain row
    By jwitte in forum Excel Help
    Replies: 3
    Last Post: 11-28-2012, 08:52 PM
  5. Find All Cells That Contain A Certain Value
    By Rasm in forum Excel Help
    Replies: 3
    Last Post: 04-26-2011, 02:43 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •