Problem with formatting

Hashiru

Active Member
Joined
May 29, 2011
Messages
286
Can any one help please.
I am having problem formating my code. I want the code to format each additional cell by clearing any format in that cell and place the desired form.

Desired format: 01/01/2011 "dd/mm/yyyy"

My code:

With Worksheets("Bank Payment").Cells(7, 1).Resize(nextrow, 1)
.Clear
.NumberFormat = "dd/MM/yyyy"
End With

nextrow is a variable that change each time an entry is made


I want to type 01/01/11 and the code format it to 01/01/2011

thanks
 
Last edited:
Thanks GlennUk it works and it is the best as my method used two lines of code to get your one short line of code
Bravo:)
 
Upvote 0

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.

Forum statistics

Threads
1,224,597
Messages
6,179,808
Members
452,944
Latest member
2558216095

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