ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How do I post the date? (https://www.excelbanter.com/excel-programming/360947-how-do-i-post-date.html)

marthasanchez

How do I post the date?
 
In VBA EXcel, I have a report that will list data. The number of records will
be different everytime I run the report. I want to add a column at the end of
the report to show today's date. How do I do this to correspond with the
number of records?

Ivan Raiminius

How do I post the date?
 
Hi,

supposing, that last column with data is "D", you can use:

dim rng as range
rng=range("D" & application.Rows.Count).End(xlUp).Offset(0,1)

rng is the range in column just next to D, in the last used row.

Regards,
Ivan


Don Guillett

How do I post the date?
 
try this idea. Change activecell.row to suit your code

Sub dateinlastcol()
Cells(ActiveCell.Row, Columns.Count) _
..End(xlToLeft).Offset(, 1) = Date
End Sub
--
Don Guillett
SalesAid Software

"marthasanchez" wrote in message
...
In VBA EXcel, I have a report that will list data. The number of records
will
be different everytime I run the report. I want to add a column at the end
of
the report to show today's date. How do I do this to correspond with the
number of records?




MartinW

How do I post the date?
 
Hi Martha,

I may be over simplifying here, but couldn't you just put
&[date] in the footer rather than part of your VBA routine.

Just a thought
Martin



marthasanchez

How do I post the date?
 
Then how do i get it to do the function?

"Ivan Raiminius" wrote:

Hi,

supposing, that last column with data is "D", you can use:

dim rng as range
rng=range("D" & application.Rows.Count).End(xlUp).Offset(0,1)

rng is the range in column just next to D, in the last used row.

Regards,
Ivan



marthasanchez

How do I post the date?
 
I need to add it as a column in a date format so that I may calculate the
dates on the report

"MartinW" wrote:

Hi Martha,

I may be over simplifying here, but couldn't you just put
&[date] in the footer rather than part of your VBA routine.

Just a thought
Martin




marthasanchez

How do I post the date?
 
I did exactly the formula below and this mehtod did noe wor?

"Don Guillett" wrote:

try this idea. Change activecell.row to suit your code

Sub dateinlastcol()
Cells(ActiveCell.Row, Columns.Count) _
..End(xlToLeft).Offset(, 1) = Date
End Sub
--
Don Guillett
SalesAid Software

"marthasanchez" wrote in message
...
In VBA EXcel, I have a report that will list data. The number of records
will
be different everytime I run the report. I want to add a column at the end
of
the report to show today's date. How do I do this to correspond with the
number of records?





Don Guillett

How do I post the date?
 
What I sent is NOT a formula. It is a macro that is tested and "this mehtod
did wor".
from the active cell (where your cursor is) if you execute this macro it
will put the date in col G if your last data is in col F. Is that what you
want?

--
Don Guillett
SalesAid Software

"marthasanchez" wrote in message
...
I did exactly the formula below and this mehtod did noe wor?

"Don Guillett" wrote:

try this idea. Change activecell.row to suit your code

Sub dateinlastcol()
Cells(ActiveCell.Row, Columns.Count) _
..End(xlToLeft).Offset(, 1) = Date
End Sub
--
Don Guillett
SalesAid Software

"marthasanchez" wrote in
message
...
In VBA EXcel, I have a report that will list data. The number of
records
will
be different everytime I run the report. I want to add a column at the
end
of
the report to show today's date. How do I do this to correspond with
the
number of records?








All times are GMT +1. The time now is 01:17 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com