+ Reply to Thread
Results 1 to 5 of 5

Macro reduces Formula Range unexpectedly.

  1. #1
    Forum Contributor
    Join Date
    05-23-2013
    Location
    Ohio
    MS-Off Ver
    Excel 2013
    Posts
    259

    Macro reduces Formula Range unexpectedly.

    Hello Everyone,

    Here's the background: I have a dashboard where the user pastes information from an online-generated excel report. They paste the entire sheet into the designated tab in the dashboard and then appropriate formulas manipulate the data as needed.

    Recently we had a problem with the online report changing columns/rows. So I did a manual find&replace to update the formulas appropriately. I'm trying to future-proof this system against further potential changes in the online report and I've done a pretty good job with one exception.

    When the data is pasted, the first 8 rows are garbage information or blank. I use the following macro to remove these rows:

    Please Login or Register  to view this content.
    I use the following formula to pull the relevant columns into a sheet that I can then use for pivot tables:

    Please Login or Register  to view this content.
    Where the C1 matches the column the formulas are in. Note: I tried index-match and it did not work in this instance (pasting new data and trimming it resulted in #Ref errors).

    Now the reason for this thread is every time Trim is run, the A1:T8000 reduces (you can see now its at 7984).

    Is there any way to prevent this? Or should I just avoid the trim macro because in truth I'm not sure its entirely necessary.

    Thoughts?

    Thanks all!

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: Macro reduces Formula Range unexpectedly.

    Deleting row
    Please Login or Register  to view this content.
    makes your range shorter each time.

  3. #3
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: Macro reduces Formula Range unexpectedly.

    You can create like this:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Red - Number of rows
    Blue - number of columns

    So deleting won't affect it (just don't delete A1

  4. #4
    Forum Contributor
    Join Date
    05-23-2013
    Location
    Ohio
    MS-Off Ver
    Excel 2013
    Posts
    259

    Re: Macro reduces Formula Range unexpectedly.

    Hi Zbor,

    Thanks for the very fast replies!

    So if I kept A1 (1 blank row at the top), how would I modify the macro to delete everything between A1 and the target criteria? Just change the range to A2?

    Also, as far as you can tell, does the current macro code select all rows and delete them at once, or one at a time? Previously I found a version that did one at a time but that was incredibly slow. This is a little faster but I'm always looking for more efficient options.

    I'll give your solution a try later this afternoon and get back to you.

    Thanks!

    -LM

  5. #5
    Forum Contributor
    Join Date
    05-23-2013
    Location
    Ohio
    MS-Off Ver
    Excel 2013
    Posts
    259

    Re: Macro reduces Formula Range unexpectedly.

    Hi Zbor,

    So it occurred to me that if I used $A:$T that takes care of my problem entirely.

    Thank you for your assistance!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Formula that searches a check register and reduces a total due
    By Lilbuda in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-16-2015, 11:41 AM
  2. [SOLVED] Macro quites unexpectedly
    By CharterJP in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 11-23-2012, 07:39 PM
  3. Array Output to Range Losing Precision Unexpectedly
    By msmithdynamicsgp in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-28-2011, 08:57 AM
  4. [SOLVED] Help with formula that unexpectedly returns an answer
    By Geoff C in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 11:05 AM
  5. Help with formula that unexpectedly returns an answer
    By bj in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-06-2005, 09:05 AM
  6. Help with formula that unexpectedly returns an answer
    By Geoff C in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 07:05 AM
  7. [SOLVED] Help with formula that unexpectedly returns an answer
    By bj in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 09-06-2005, 05:05 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1