Trev0j

New Member
Joined
May 27, 2018
Messages
28
Good day..

Need help - Newbie in VBA coding.

have below code:

Columns("Z:Z").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Range("A1").Select
ActiveCell.FormulaR1C1 = "=TODAY()"
'Selection.Copy
Range("x3").Select
Selection.End(xlDown).Select
ActiveCell.Offset(0, 2).Range("A1").Select
Range(Selection, Selection.End(xlUp)).Select
Application.CutCopyMode = False
Selection.FillDown
Selection.End(xlDown).Select
Range(Selection, Selection.End(xlUp)).Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False

Code is working fine when Multiple lines are added in a row.
hope to find working code when only single line is added.

thanks
 
Re: TODAY() - error for single row.

Presumably you have pasted some data to column X (and possibly other columns) and wish to put the date in column Z for the new data rows.
Based on the code you posted, I will assume that the pasted data is selected, so :

Code:
Intersect(Selection.EntireRow, [Z:Z]) = Date
 
Upvote 0

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Re: TODAY() - error for single row.

Maybe....

Code:
Sub xxxxx()
Range(Range("Z" & Rows.Count).End(xlUp).Offset(1), Range("Z" & Range("X" & Rows.Count).End(xlUp).Row)) = Date
End Sub

Looks fine! - Thank you very much...
 
Upvote 0
Re: TODAY() - error for single row.

thank you... it works also..
but i have codes before the one i posted thats why it is deselected.

Thank so much..
 
Upvote 0
Re: TODAY() - error for single row.

@Trev0j
Please do not post the same question multiple times. All clarifications, follow-ups, and bumps should be posted back to the original thread. (rule 12 here: Forum Rules).
I have merged both your threads.
 
Upvote 0

Forum statistics

Threads
1,215,635
Messages
6,125,946
Members
449,275
Latest member
jacob_mcbride

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