+ Reply to Thread
Results 1 to 17 of 17

Move all rows 1 down but skip row 26 & Public Function IF problem

  1. #1
    Forum Contributor
    Join Date
    09-08-2009
    Location
    Norway
    MS-Off Ver
    Excel 2002
    Posts
    142

    Move all rows 1 down but skip row 26 & Public Function IF problem

    Hey guys, its me again :p

    I've got a pretty nice Worklist setup in Excel that enables you to organize all the work you need to do in a month. However i end up with little holes in the list whenever i finish a task because what my macroes does is whenever a job is marked as done on the list it moves that job to sheet2, which contains completed jobs. I'd like to have a macro that shifts all the rows 1 down whenever a job is completed(ill just call it from the job complete macro) but it needs to jump over(skip) row 26 because that row contains some images that my macros use. Altso i would like to, if possible avoid inserting any rows or cells or hiding them because that will totally mess up my macros :p I know i know, im not dynamic enough.


    I've included a sample of the worksheet so you can see what i want.

    By the way, I've altso got some trouble with a public function.

    Please Login or Register  to view this content.
    I'm trying to have this code insert Timestamp whenever a cell in side the Ranges is clicked, so far it does work but the timestamp changes when its clicked again, so i tried entering If Target = 0 to force it to only do it when the cell is empty, but it runs on all the cells now Anyone know a quick fix for this? =)

    Thanks in advance,

    George.
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    10-15-2007
    Location
    Home
    MS-Off Ver
    Office 2010, W10
    Posts
    373

    Re: Move all rows 1 down but skip row 26 & Public Function IF problem

    Hi George

    For your second question try:

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    09-08-2009
    Location
    Norway
    MS-Off Ver
    Excel 2002
    Posts
    142

    Re: Move all rows 1 down but skip row 26 & Public Function IF problem

    Thanks! That worked well Just 1 quick note, is there any easy command to have the range ignore row 26? or do i have to define each cell individually then?

    Cheers

  4. #4
    Forum Contributor
    Join Date
    09-08-2009
    Location
    Norway
    MS-Off Ver
    Excel 2002
    Posts
    142

    Re: Move all rows 1 down but skip row 26 & Public Function IF problem

    upon further testing i realized that this new code is interfering with me existing code,

    whenever i try to run this:

    Please Login or Register  to view this content.
    I get the error message: run time error 13 type mismatch

    and when i click debug i'm pointed to:

    Please Login or Register  to view this content.
    The part in bold is the part that is yellowed out. I'm assuming something here is interfering with my code running properly.

  5. #5
    Forum Contributor
    Join Date
    09-08-2009
    Location
    Norway
    MS-Off Ver
    Excel 2002
    Posts
    142

    Re: Move all rows 1 down but skip row 26 & Public Function IF problem

    Ok, so the part that was supposed to be bold is

    Please Login or Register  to view this content.

  6. #6
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,595

    Re: Move all rows 1 down but skip row 26 & Public Function IF problem

    You said:
    i end up with little holes in the list whenever i finish a task because what my macroes does is whenever a job is marked as done on the list it moves that job to sheet2
    But, then

    I'd like to have a macro that shifts all the rows 1 down whenever a job is completed
    So, which sheet gets the rows moved down? Sheet2 with its list of completed jobs do that the latest job is at the top?
    Or, the list on sheet1? It seems to me that if you move a record from sheet1 to sheet2 leaving a hole in sheet1, then you would want to move the tasks below the hole UP one to fill that hole, not down one.

    However, prefix , you did not provide any sample tasks for either sheet.
    Ben Van Johnson

  7. #7
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Move all rows 1 down but skip row 26 & Public Function IF problem

    It sounds like you want row 26 to be stationary.
    If a row (or non-whole row cells?) were inserted above that, you would want the old row 25 to become the new 27 as everything else shifts down.

    Is that the situation?
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  8. #8
    Forum Contributor
    Join Date
    09-08-2009
    Location
    Norway
    MS-Off Ver
    Excel 2002
    Posts
    142

    Re: Move all rows 1 down but skip row 26 & Public Function IF problem

    File Type: xls Book1.xls (165.5 KB, 2 views)

    I uploaded this the same time i made the first post..

    This contains the relevant data, or a sample of it anyway.
    It's the first sheet i need shifted down, i've already sorted sheet2 with a simple insert.shift.xldown

    But the 1st sheet isnt so simple since it has a huge gap in Row 26 and i don't know how jump over it without using an offset and that would mean offsetting each and every row.. Would be nice if someone knew an easy way

  9. #9
    Forum Contributor
    Join Date
    09-08-2009
    Location
    Norway
    MS-Off Ver
    Excel 2002
    Posts
    142

    Re: Move all rows 1 down but skip row 26 & Public Function IF problem

    Quote Originally Posted by mikerickson View Post
    It sounds like you want row 26 to be stationary.
    If a row (or non-whole row cells?) were inserted above that, you would want the old row 25 to become the new 27 as everything else shifts down.

    Is that the situation?
    Indeed, that is the situation

    Any help would be greatly appreciated
    Last edited by prefix; 01-25-2010 at 03:54 AM.

  10. #10
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Move all rows 1 down but skip row 26 & Public Function IF problem

    You could put this in the sheet's code module. Then if a cell (in a discreet location) had the formula =ROWS(1:65536), the Calculate event would be triggered by the inserting or deleting of a cell.
    Please Login or Register  to view this content.
    In the attached Row 5 is the stationary row.
    The action is restricted to columns 1-50 of that row, but the constants can be altered to meet your situation.
    For example, you want stationaryRow to be 25

    Edit: One line should be changed.
    Attached Files Attached Files
    Last edited by mikerickson; 01-25-2010 at 10:07 AM.

  11. #11
    Forum Contributor
    Join Date
    09-08-2009
    Location
    Norway
    MS-Off Ver
    Excel 2002
    Posts
    142

    Re: Move all rows 1 down but skip row 26 & Public Function IF problem

    Awesome! Thanks heaps for that answer :-)
    Wish there was a feature for this in Excel where you could ignore a certain row from Shift:=xlDown. Oh well, this code you wrote is certainly very flexible and it can probably be implemented into any existing sheet again, Thank you for spending your time to help me. Rep has been added

    Hate to ask but does anyone know the answer to my second question too? My workbook won't run without solving that particular issue.

    To recap i have the code i want but it seems to be working outside its range from what i can understand, this is the code:

    Please Login or Register  to view this content.
    Whenever i click a button i made that runs this macro:

    Please Login or Register  to view this content.
    The RemovePic2 macro code is:

    Please Login or Register  to view this content.
    I can only assume something here is messing with the Timestamp code.

    When i run the code i just pasted i get: Run time error 13 type mismatch and when i click debug i'm pointed to:

    Please Login or Register  to view this content.
    Inside the Timestamp function.

    Anyone got any ideas?

  12. #12
    Forum Contributor
    Join Date
    09-08-2009
    Location
    Norway
    MS-Off Ver
    Excel 2002
    Posts
    142

    Re: Move all rows 1 down but skip row 26 & Public Function IF problem

    By the way, i get the same error whenever i select a bunch of cells by dragging around them, i tried changing Target to Trgt by dimming it as range but then it just gives me a compile error.

    edit: altso tried changing Target = 0 to Target = "" but it didnt affect it in any way.

  13. #13
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Move all rows 1 down but skip row 26 & Public Function IF problem

    Please Login or Register  to view this content.
    Although, you may want to put the datestamp in the Double Click event rather then SelectionChange. Selection is vital to working a spreadsheet and changing cell's value when it is selected can be too volatile for my taste.
    Last edited by mikerickson; 01-26-2010 at 11:11 AM.

  14. #14
    Forum Contributor
    Join Date
    09-08-2009
    Location
    Norway
    MS-Off Ver
    Excel 2002
    Posts
    142

    Re: Move all rows 1 down but skip row 26 & Public Function IF problem

    Awesome! When you put it that was using Selection does seem pretty silly :D I didn't know there was a Double Click event to use, i'll definately use that

    Thanks a bunch for your time

  15. #15
    Forum Contributor
    Join Date
    09-08-2009
    Location
    Norway
    MS-Off Ver
    Excel 2002
    Posts
    142

    Re: Move all rows 1 down but skip row 26 & Public Function IF problem

    Quote Originally Posted by mikerickson View Post
    You could put this in the sheet's code module. Then if a cell (in a discreet location) had the formula =ROWS(1:65536), the Calculate event would be triggered by the inserting or deleting of a cell.
    Please Login or Register  to view this content.
    In the attached Row 5 is the stationary row.
    The action is restricted to columns 1-50 of that row, but the constants can be altered to meet your situation.
    For example, you want stationaryRow to be 25

    Edit: One line should be changed.
    I am trying to get this to work so far it does not do what i want.. I am posting my entire workbook since it does not contain any sensitive information.

    Whenever i insert a row stationary row 26 becomes row 27 and whenever my macro does selection.clearcontent and a gap appears between lines(you'll see what i mean in the worksheet) it does not shift them in the proper order..

    ...Once again i failed to upload a file attachment to this post and had to resort to alternative file hosting, hopefully this will be ok with whoever writes an answer.. I would use excelforum if i could but it just gives me errors.. and no, the xls is not above 1mb :P

    Anyway, here's the workbook just type in the captcha and hit Free Download..

    http://ulozto.net/3797153/tiltakslistev3.xls

    Thanks!

  16. #16
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Move all rows 1 down but skip row 26 & Public Function IF problem

    One thing I noticed is that your pictures should be formatted to have the property Don't move or Size with cells.

    Another thing is that this won't work with merged cells, (problem). But I don't see why Merged Cells are being used, I changed them to Center Across Selection.

    I put the posted routine in the code module for Aktive Oppgaver (after changing this line to reflefer to the actual sheet.)
    Please Login or Register  to view this content.
    I changed the constants to reflect your needs.
    Please Login or Register  to view this content.
    And put =ROWS($1:$65536) in 'Aktive Oppgaver'!N26 to trigger the Calculate event upon insertion/deletion of a cell.

    (About uploading files, did you Compress/Zip the files before attempting to upload?)
    Attached Files Attached Files
    Last edited by mikerickson; 01-27-2010 at 10:22 AM.

  17. #17
    Forum Contributor
    Join Date
    09-08-2009
    Location
    Norway
    MS-Off Ver
    Excel 2002
    Posts
    142

    Re: Move all rows 1 down but skip row 26 & Public Function IF problem

    Thanks! I didn't know merging cells could cause problems like that. I'll make sure to avoid it whenever possible in the future As for the pictures property if they are set to dont move or size they will not hide when you click the number 2 in the top left corner, which is what i usually do when i print this thing.
    As for the zipping, i have been able to upload xls without zipping earlier, and the size of the file was below 1mb, so i don't understand why i get these uploading errors every once in a while.

    I was under the impression my constants were set right, but i may be wrong :p oh and i already had

    =ROWS($1:$65536) on my aktive oppgaver sheet its just that i put it at the very bottom and changed the text color to white

    Anyway, Thank you for your time and your answer

    Question: how did you set the cells to Center Across Selection?

    edit: found the answer to my own question just after posting :p
    Last edited by prefix; 01-28-2010 at 03:28 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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