ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   From CellA1 to a column of Date (https://www.excelbanter.com/excel-programming/354279-cella1-column-date.html)

Toto Sanderson

From CellA1 to a column of Date
 
Hi all experts, this is probably a very simple question but I am just stuck
here.

A1 is a Date, how can I read from A1 and write a column in another worksheet
of the date from first day to last day of the month and year of A1?

Many thanks in advance!

Niek Otten

From CellA1 to a column of Date
 
=IF(MONTH($A$1)=MONTH(DATE(YEAR($A$1),
MONTH($A$1),ROW(A1))),DATE(YEAR($A$1),MONTH($A$1), ROW(A1)),"")

Copy down to 31 rows

--
Kind regards,

Niek Otten

"Toto Sanderson" <Toto wrote in message
...
Hi all experts, this is probably a very simple question but I am just
stuck
here.

A1 is a Date, how can I read from A1 and write a column in another
worksheet
of the date from first day to last day of the month and year of A1?

Many thanks in advance!




Toto Sanderson[_2_]

From CellA1 to a column of Date
 
Thanks for your quick response. But it doesn't work on my case.

Say,

m = Month(Worksheets("Sheet1").Cells(1, 1))
y = Year(Worksheets("Sheet1").Cells(1, 1))

in Sheet 2, how can I make the value of Cell B1 as the Date 01 to 30/31 of
month m and year y?

The following code doesn't work:
Worksheets("Sheet2").Cells(1, 2) = DATE(y, m, 1)

Please help again! Thanks!

"Niek Otten" wrote:

=IF(MONTH($A$1)=MONTH(DATE(YEAR($A$1),
MONTH($A$1),ROW(A1))),DATE(YEAR($A$1),MONTH($A$1), ROW(A1)),"")

Copy down to 31 rows

--
Kind regards,

Niek Otten

"Toto Sanderson" <Toto wrote in message
...
Hi all experts, this is probably a very simple question but I am just
stuck
here.

A1 is a Date, how can I read from A1 and write a column in another
worksheet
of the date from first day to last day of the month and year of A1?

Many thanks in advance!





Niek Otten

From CellA1 to a column of Date
 
<The following code doesn't work:
Worksheets("Sheet2").Cells(1, 2) = DATE(y, m, 1)

Use DateSerial instead

--
Kind regards,

Niek Otten


"Toto Sanderson" wrote in message
...
Thanks for your quick response. But it doesn't work on my case.

Say,

m = Month(Worksheets("Sheet1").Cells(1, 1))
y = Year(Worksheets("Sheet1").Cells(1, 1))

in Sheet 2, how can I make the value of Cell B1 as the Date 01 to 30/31 of
month m and year y?

The following code doesn't work:
Worksheets("Sheet2").Cells(1, 2) = DATE(y, m, 1)

Please help again! Thanks!

"Niek Otten" wrote:

=IF(MONTH($A$1)=MONTH(DATE(YEAR($A$1),
MONTH($A$1),ROW(A1))),DATE(YEAR($A$1),MONTH($A$1), ROW(A1)),"")

Copy down to 31 rows

--
Kind regards,

Niek Otten

"Toto Sanderson" <Toto wrote in
message
...
Hi all experts, this is probably a very simple question but I am just
stuck
here.

A1 is a Date, how can I read from A1 and write a column in another
worksheet
of the date from first day to last day of the month and year of A1?

Many thanks in advance!








All times are GMT +1. The time now is 11:14 PM.

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