Macro to paste today's date on last column of specific rows?

karthick019

New Member
Joined
Jul 15, 2011
Messages
10
Hello Experts,

I have a situation where there are few rows for which I should paste date from Workings column to the last column of that Row.

Refer below example for clear understanding,

ID
1st Case
2nd Case
3rd Case
4th Case
5th Case



Working
A1
01/05/2016
15/06/2016
27/09/2016
27/09/2016
A2
04/03/2016
17/07/2016
23/07/2016
A3
08/05/201616/06/2016
29/07/2016
11/08/2016
A4
03/02/2016
27/09/2016
27/09/2016
A5
07/03/2016
06/04/2016
03/08/2016


As you could see in the above example, I need a macro that will paste the dates from Working Column to the respective last column of the row.

Please do let me know if you are still not clear on the question and I will try to explain better.

Would be very helpful if I could find a macro for this.

Thank you in advance.


Regards,
Karthick. S
 
Note that I mentioned my original code was backwards, and have since removed it. Peter's original code got a little messed up. I am not sure why, but when posting code, sometimes it blends the first two lines of code together. I went back to his code and fixed it.

If your working column is Column Z, just edit Peter's code like this:
Code:
Sub CopyDate()

    Dim c As Range
  
    For Each c In Range("Z2", Range("Z" & Rows.Count).End(xlUp))
        If IsDate(c.Value) Then c.End(xlToLeft).Offset(, 1).Value = c.Value
    Next c
    
End Sub
If that doesn't work, please let us know exactly what is happening, and confirm that your date column are really blank, and not formulas returning nothing.



Wow, that did it.!!!


Works like a charm... Thanks a lottt guyz :) :) :)
 
Upvote 0

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
I want the data's in Column Z to be pasted in their corresponding last column on the row (CTRL+LEFT from "Z") respectively.
That contradicts your image from post #8. In that image there is data in a column between your working column and where you want the date pasted. Also, your working column is not column Z in that image. CTRL+LEFT from the working column would not get you to the desired location. Very difficult to give you a good solution if the goalposts keep moving.

Please take a few moments to determine exactly what the layout and requirement is then tell us clearly.


Edit: I hadn't seen your last post while I was composing this one. I don't see how that could work if you have an "Address" column with data between the working column and the paste location.
However, if you are happy, then so am I.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,216,105
Messages
6,128,859
Members
449,472
Latest member
ebc9

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top