The new forums will be named Coin Return (based on the most recent
vote)! You can check on the status and timeline of the transition to the new forums
here.
Excel: For End of Month of sales report, need to delete columns for each of the days.
There's a "Month to Date" sheet where a macro creates a new column and pastes all the values from that day into that column. End of the month, those daily columns are erased.
What we have been doing so far is, end of the month just manually deleting those columns. That's the entire "end of month" process.
I'm trying to google ways to do that automatically. It's harder than I thought it might be. I will probably figure it out in time. I just don't know VBA well enough.
Either I have to retrieve the number of days from the previous month (since the end of day macro would already have been run) or I have to reference the 'date' cell in each daily column, check if it's blank, and delete the rows one at a time like that.
I have no idea.
0
Posts
Sheets("MTDFront").Select
ActiveSheet.Unprotect
Range("D3").Select
Range(Selection, Selection.End(xlToRight)).Select
Range.EntireColumn.Delete
Except I can't use Range to delete an entire selection of columns with just a cell highlighted.
I can use End to select highlight all the right columns, but just a cell in each, not the entire column. I don't know how to translate highlighted cells into highlighted columns. If I find that one, I'll be able to delete all the highlighted columns and be done!
Basically it takes the starting cell you put in your example. Extends the range out by 40 columns, then goes though and deletes every column in that range one by one.
I can't help but shake the feeling that there's a way to get all the columns you want as a range and then just delete them all without the loop. Been a while since I did VBA in Excel though.
Otherwise, yeah, I'd definitely just
Range("D:AH").Deletethatshit.
Like I mentioned, I'm sorta rusty with Excel.
Thanks a lot.