Hello,
I want a macro to unhide about 20 blank rows copy values into the top row then hide the remaining rows (some cells have fill though) then the next time it will unhide the rows and copy values into the next available blank row and hide the remaining blank one. I know it sounds complicated, any ideas?
Craig
Configuration: Windows Vista Internet Explorer 7.0
Hi and thanks for your reply. This is my macro but what I need it to do (and I know it sounds complicated) but it has to copy the data as said then insert a row above it, unhide the 20 rows below it, delete one of them and rehide them. Is this possible at all???
|
I think we're getting close and I'm trying to understand the coding but struggling. I had to take the word private out at the beginning to make it work and altered the row range to 22 and it works except what the macro is doing is putting data into a list but with the coding as it is at the minute its inserting one row of data then deleting it when it inserts the next, where as i need it to delete the next blank row (which is hidden) and not hide any of the inserted data. Any ideas? Also is it possible to return the cursor back to the cell where it copied the data from, obviously this isn't the same cell everytime?
|
If you let me know how I can provide you with a sample sheet then i can do this. Meanwhile, basiically i have 20 rows hidden and one above it which is not, this is where the data is copied into then a row is inserted above it and i need only one of the blank rows below it deleted. The rows are basically hidden so that the formula below them that adds up the totals aren't affected and the data below that stays static too.
|
Reply to craigo
|
I'm not sure what's it's not doing now. the way the list is forming is perfect, exactly what I was looking for, but I do need the row numbers to stay the same. It was doing this before when one was inserted to move the data down to make way for the next data then deleting a row below it? Do you know what I mean?
|
Hi, it's not compiling the list now, it's only leaving the data last placed there and the previous is disappearing. I'm not sure if the data is copying over the previous or whether that's the row that's being removed? One more thing on this, after data has been inserted is it possible to return the curser (active cell) to the B column of the data that was just inserted?
|
That's excellent, thanks, I must have been downloading the wrong one. Now to try and explain the meals and day planner copy and paste. On the meal counter tab, imagine that there's four things in the list so if you scroll to the data on the right they'll be (or will be) showing up in that list. What I'd like to do is copy that data as a block, so in this instance it will be W31 across to AO31 and down to row 34. (There could be more or less in the list though so it has to know where the data ends) That would then be copied (Values & format) and pasted in the next available slot on the meal and day planner tab. I've manually put 3 examples on that tab (I know the select buttons a different colour) as they would hopefully look, each with a space between them. Also I would like to hide the data on the meal counter page so I'm taking it that it would need unhiding? |
OK, here is my first stab at it. Columns W thur AO are hidden. I deleted the rows on the Meals & Day Planner tab so you can see how the macro works. The data copied from the table will only be what is filled. Once it is pasted, it will be with formats and values. Also the formatting for the word "Select" will change as you requested. I have a command button on the Meal Counter sheet called Copy to M&D Planner. Click it to see the macro run. I put Rev1. at the beginning of the file name. This is just to make sure you get the updated copy.
|
That's absolutely perfect, I'm so impressed, thank you. The only thing it needs is both sheets protecting everytime.
|
1) The sheet protection is back in the code. I took it out while testing so it would not aggravate me.
|
Hello again. I've uploaded the latest version and just called it "calorie counter" The part I'm stuck on which I mistakenly thought I had the info for is how to offset from the active cell then copy for example the next 5 cells. As you'll see on meal and day planner my aim is to select the "select" cell then click the appropriate number button. The macro then should offset, from the active cell, one to the right and copy all data up to column M but all its doing is copying column M and none of the others. This is also the basis I want to use for the delete button. When a delete cell is clicked it offsets to the data and deletes it?
|
Reply to craigo
|
I was just checking the sheet again, and I noticed the sort was not working when copying and pasting. It should be corrected now. Use this copy.
|
Thats great, I've got the buttons working spot on now. When I click to save meal (On my button now) it unhides my refresh button in columns w&X. Also I can't delete the button that you made?
|
Now I see that it was the design mode that I was missing for your button delete, sorted now thanks.
|
I had a minute to work on the Refresh and Add Foods buttons. I think it is how you want it now.
|