How can I format the selected range using two lines shown?

Posted on 2012-09-07
Last Modified: 2012-09-07
I'm using the "Copy & Paste" Code as shown below and I would like to format the selected range as a Date & change the alignment.

rngSrc.Offset(, 2).Copy
rngDst.Offset(LastRow, 5).PasteSpecial xlPasteValues

I have tried the below without any success.

Selection.NumberFormat = "m/d/yyyy"
            With Selection
                .HorizontalAlignment = xlRight
                .VerticalAlignment = xlBottom
                .WrapText = False
                .Orientation = 0
                .AddIndent = False
                .IndentLevel = 0
                .ShrinkToFit = False
                .ReadingOrder = xlContext
                .MergeCells = False
            End With

Can someone help?

Question by:user2073
    LVL 33

    Accepted Solution

    Replace Selection with the range you want to format, rngDst.Offset(LastRow, 5).

    Author Closing Comment

    Thank you for your help. I'm moving forward and have achieved great results only with you assistence.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Approximate matching with VLOOKUP and MATCH seems to me to be a greatly under-used technique, and one which is vital for getting good performance out of large lookups. Until recently I would always have advised using an exact match for simplicity an…
    This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
    The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
    This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now