Pasting From MS Access

SRienstra

New Member
Joined
Dec 3, 2009
Messages
14
When pasting data including long text or dates, from Access, the default in Excel is to put word wrap on each pasted value (not the column headings) and to format dates as dd-mmm-yy. This is inconvenient to me, as I generally don't want random row heights for pasted data and I never want dd-mmm-yy date format. Is there a way to alter this default behavior?
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Not that I know of.

However, you can create a "formatting macro" that you can save to your Personal Macro Workbook in Excel. Then it is always available to you, and you can simply run it whenever you like to correct the formatting of your copied Access data. You can get most of the VBA code you need simply by using the Macro Recorder and recording yourself making these changes.

I use something like this myself to fix the wrapping problems and column widths.
 
Upvote 0
Is there a way to tell a macro to reformat only those cells that contain dates?

Minor clarification to original post: The dd-mmm-yy formatting is only applied to query results copied from Access, not tables.

I would use the "Keep Destination Formatting" option if it weren't for the leading zeroes that I often have in my data.
 
Last edited:
Upvote 0
Yes, you can use the IsDate function in VBA to determine if a column has date entries. I would just program it to check the first row in each column to determine that.
 
Upvote 0

Forum statistics

Threads
1,224,522
Messages
6,179,299
Members
452,904
Latest member
CodeMasterX

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