ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   format calling cell (https://www.excelbanter.com/excel-programming/408211-format-calling-cell.html)

RedLars

format calling cell
 
Hi,

When calling a macro from a cell in excel, how can I set the format of
that cell to use for instance Date dd.mm.yyyy ? Do I need to supply
location of the cell I want to format (using Range?) ? Would
appreciate any example.

Thanks.

Jarek Kujawa[_2_]

format calling cell
 
i am not sure what your are up to, could you be more specific?

there are cases when it is not necessary to supply the location by
showing address

Jarek Kujawa[_2_]

format calling cell
 
one way:

ActiveCell.NumberFormat = "dd.mm.yyyy;@"

what do you mean by "calling a macro from a cell"?

RedLars

format calling cell
 
On 24 Mar, 11:57, Jarek Kujawa wrote:
one way:

ActiveCell.NumberFormat = "dd.mm.yyyy;@"

what do you mean by "calling a macro from a cell"?



Thanks for your reply.

I apologise for the rather quickly written post.

In a few cells in excel I will parse a string into a date format and
would also like to set the format of that cell to Date (dd.mm.yyyy)
using vba.

So for instance in cell B4 I would write =FormatCell(L4). L4 would
then contain a text which will contain a date (and possibly other
text). The purpose of FormatCell is to parse the text but if the
format of the cell (B4) is not of type date the displayed value is
wrong (using the format "standard" give the following output 39432,
but using the format "date" give me the correct output of
16.12.2007).

Will give your example a try.


All times are GMT +1. The time now is 12:02 AM.

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