+ Reply to Thread
Results 1 to 4 of 4

Hiding columns - out of memory

  1. #1
    Registered User
    Join Date
    10-28-2012
    Location
    brussels
    MS-Off Ver
    Office 365
    Posts
    42

    Hiding columns - out of memory

    Hi all,

    i'm having trouble with this simple piece of code ...
    What it does : it looks in a row what the last cell is with a value, then it goes in a loop (max untill that last cell) where the year factor of a date will be compared to a value you filled in on the userform. I want it to remember the first column it encounters with that year. All the columns which came before have to be hidden.

    But, selecting the cell and looking at the year always gives me an "out of memory" fault. So i can't even check if the rest of the code works too

    Can you guys help me out ???

    Thanks in advance,

    megabolic
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Hiding columns - out of memory

    This gives you a simple method to hide columns based on the active cell.
    It looks at row 6 of the column of the active cell to determine the year and then, starting at column H finds the first incidence of that year.

    This is easily adapted. The trick is the little loop and what is fed into it as the variable "myyear"
    The value of variable "col" when the loop has finished minus 1, is the last column number of the previous year

    Please Login or Register  to view this content.
    Last edited by kev_; 01-08-2017 at 08:02 AM.

  3. #3
    Registered User
    Join Date
    10-28-2012
    Location
    brussels
    MS-Off Ver
    Office 365
    Posts
    42

    Re: Hiding columns - out of memory

    thanks for all the help !

  4. #4
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Hiding columns - out of memory

    You are welcome
    Thanks for the reps

+ 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. [SOLVED] Thrashing VBA Memory Leaks. Memory Loop Problems. Uncleared Memory in .Match Range Object
    By Doc.AElstein in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-10-2017, 05:17 PM
  2. [SOLVED] Hiding and un hiding columns using VBA code
    By Jes1397 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-20-2015, 12:52 AM
  3. Hiding columns in excel without hiding form button
    By rename in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-01-2013, 01:38 AM
  4. Replies: 9
    Last Post: 09-19-2012, 05:31 AM
  5. Un-Hiding and Hiding Columns based on Drop-Down Values in a Column.
    By e4excel in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 10-30-2011, 09:24 AM
  6. Un-Hiding and Hiding Columns based on Drop-Down Values in a Column.
    By e4excel in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-11-2011, 06:49 AM
  7. Replies: 2
    Last Post: 10-18-2005, 10:05 PM

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