Hi!
In a worksheet I have two Date columns and want to hide those rows where dates in the column match. I have a recorded a macro and am not able to do this, please help.
Thanks
Hi!
In a worksheet I have two Date columns and want to hide those rows where dates in the column match. I have a recorded a macro and am not able to do this, please help.
Thanks
Maybe:
Assumes the date Columns are A and B.Please Login or Register to view this content.
Hi John,
Thanks for the reply. I am doing macros first time so excuse me if I am wrong. You have mentioned assumption that date columns are A and B but in the code I can see only "A" and no "B". Do I have to replace 'A' in "In Range("A2:A" & ActiveSheet.UsedRange.Rows.count + 1)"? My actual date columns are 'EXPIRY_DATE' at F & 'TIMESTAMP' at O and sheet nos. are "Sheet3" & "Sheet5" containing this data. How will I change the code with this data? Secondly, in the code 'If rcell.Value = rcell.Offset(, 1).Value then', within parenthesis there is a "comma" but no parameter before that, is there something missing? Thanks again.
Last edited by shailew; 12-26-2013 at 12:09 PM. Reason: For better clarity
No. The rcell represents items in Column A, whereas it is checking against rcell.Offset(,1) this is the value one column over (Column B). Therefore it will check column A against the value in Column B. If they match it will hide the row for the item. The Offset command tells it where to look. Offset(row,column). Since the rcell range is on the same row you leave the row offset blank. The one tells it to look one column over. Offset(,1). Same row one column over. Hope that helps.
Hi John,
Thank you so much. Your code worked perfectly. I want one more help. Hidden rows did not solve my purpose, how can I delete these rows instead? I tried changing "delete" with "hidden = true" but it did not work out. What changes do you need to deleting the rows in the same code?
I further wanted to tell you that I was worried about the size & complexity of the code for my above query but it was so simple and compact and I really appreciate that. Thanks again.
Try:
Please Login or Register to view this content.
Thank u so much John. It worked perfectly.
You're welcome. Glad to help out and thanks for the feedback.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks