Hi,
I have column with many different effective date and which may not begin with Sunday dates. Is it possible to do a macro which change the date to Sunday Date for each cell if date is not equal sunday date?
Thanks & Regards,
Shiva
Hi,
I have column with many different effective date and which may not begin with Sunday dates. Is it possible to do a macro which change the date to Sunday Date for each cell if date is not equal sunday date?
Thanks & Regards,
Shiva
Last edited by shiva_reshs; 09-20-2013 at 10:08 AM.
I guess you already have prior experience with VBA.. and you can adapt below formula in VBA..
Formula:Please Login or Register to view this content.
or please upload a sample file.. for structure of sheet..
Regards!
=DEC2HEX(3563)
If you like someone's answer, click the star to give them a reputation point for that answer...
Hi,
Sorry. Having issue with uploading document.
1) Column I is the Start date which I want to be a Sunday Date. Based on a below condition.
a) If, Column Q cell value is BW and Column I date is >= 06/30/13, else highlight the row to Yellow color.
b) If, Column Q cell value is BS and Column I date is >= 06/16/13, else highlight the row to Yellow color.
C) If, Column Q cell value is BA and Column I date is >= 06/09/13, else highlight the row to Yellow color.
d) If, Column Q cell value is BZ and Column I date is >= 07/01/13, else highlight the row to Yellow color.
Thanks
Shiva
Last edited by shiva_reshs; 09-19-2013 at 12:36 PM.
Keep the Forum clean :
1. Use [ code ] code tags [ /code ]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
2. Show appreciation to those who have helped you by clicking * Add Reputation below their posts.
3. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.
90 views so far.
Is this code possible or too much coding required?
Thanks..
After 2 days of trial n error, I was able to make up a code which changes the dates to a sunday date.
but, I am not able to get the coloring right for cell. The problem I am facing arePlease Login or Register to view this content.
1) Some cell getting colored to yellow, even though the dates are Sunday Date.
2) When I second time run this macro, every cell is getting colored to Yellow.
Appreciate, if someone have any tips on it.
Thanks
It looks like on your workbook column Q is empty, therefore all the cells are getting set to yellow. I'd probably do something like:
I believe your reply was not saved.
like??? what???
Sorry, I meant to delete it as decided it wasn't relevant. Meant to delete the last bit of the reply.
ohhk.
I updated entire column Q till data but still same issue.
Please upload new workbook with data.
Here is the file
Thanks
Sorry. I just missed to update the workrage tofrom oldPlease Login or Register to view this content.
File is same just incase you get debug error messages.Please Login or Register to view this content.
Thanks
Last edited by shiva_reshs; 09-24-2013 at 10:34 AM.
?Please Login or Register to view this content.
woo.. Thats was very fast...
Cool.....
One more query though. I was able to code it as per single condition. But if you look my original post, I have been trying to do it for 4 different condition.
a) If, Column Q cell value is BW and Column I date is >= 06/30/13, else highlight the row to Yellow color.
b) If, Column Q cell value is BS and Column I date is >= 06/16/13, else highlight the row to Yellow color.
C) If, Column Q cell value is BA and Column I date is >= 06/09/13, else highlight the row to Yellow color.
d) If, Column Q cell value is BZ and Column I date is >= 07/01/13, else highlight the row to Yellow color.
Can these be coded on a single macro above?? or Should I need to create 4 different macros??
Thanks
Maybe:
Please Login or Register to view this content.
I get this error message
Please Login or Register to view this content.
Removed the spaces
it work now..Please Login or Register to view this content.
just for my learning. These days, I am playing around with offset function.
So in your above code, when Column I changes to Sunday date; how can I add the offset , so the next cell (Column J) changes to Next Saturday date??
Or should I rebuild the code for Column J, Instead of using offset function here?
Thanks
Please Login or Register to view this content.
Not sure what went wrong, I added offset like below.
Result isPlease Login or Register to view this content.
I added offset code only at BW cell. So I got error only with cell value of BW.PHP Code:
Start Date* End Date
2013-04-04 2013-08-17
2013-06-15 2013-08-17
2013-04-07 2013-08-17
FALSE 2013-08-15
2013-06-30 2013-08-17
FALSE 2013-08-17
FALSE 2013-08-17
Last edited by shiva_reshs; 09-24-2013 at 11:10 AM.
You can't have your code on one line like that, you need:
I added some extra .values in case that helped.Please Login or Register to view this content.
Thanks it works..
What it is doing now is, if there is Date 08/15/2013, it goes back to previous Saturday to 08/10/2013. But If I want to make it coming days Saturday, i.e 08/17/2013?? then how?
Note: Sunday function perfect. I am just curious to understand, how to make it cell changes to Next saturday on next column cell..
Thanks.
Can you upload your code again, as far as I can see it gives the next saturday
Here it is..
Thanks
works fine?
In Column J9, effective date I had entered is 08/15/2013. VBA turns the date to saturday date, but of previous week i.e 08/10/2013.
I am trying change the date to coming Saturday date , i.e 08/17/2013.
I hope, I am not confusing you again..
Thanks
You asked for:
So in your above code, when Column I changes to Sunday date; how can I add the offset , so the next cell (Column J) changes to Next Saturday date??
So in I9 you have 04/08/2013 therefore J9 should changed to 10/08/2013.
If you want to just change it to the next saturday after the date you entered in the cell just do it in a separate macro the same way you did the sundays, no need to use offset functions.
ohhk..
Thanks yudlugar!!
Regards,
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks