Try this, this will search a whole used range in sheet, that will be very slow if you have a big data

*Private Sub CommandButton1_Click()**
**    Dim Rng As Range**
**    For Each Rng In ActiveSheet.UsedRange**
** If IsDate(Rng.Value) Then Rng.Value = Format(Rng.Value, "dd mmm yyyy")**
**    Next**
**End Sub*

Rgds,
[dp]

Pada 12/07/2013 1:45, srsev6 menulis:
Thanks Ashish but the dates don't always fall in column D and are not always just two columns. How can I change this portion to search the entire sheet? I tried several options to no avail.
For Each cl In Range("d2:d" & Range("d1048576").End(xlUp).Row)

On Thursday, July 11, 2013 11:47:18 AM UTC-5, ashish wrote:

    try this
    Sub sample()
    Dim cl As Range
        For Each cl In Range("d2:d" & Range("d1048576").End(xlUp).Row)
            cl.NumberFormat = "@"
            cl.Value = Application.WorksheetFunction.Text(cl.Value,
    "dd mmm yyyy")
        Next

    End Sub

    see if it helps




    On Thu, Jul 11, 2013 at 9:43 PM, srsev6 <srs...@gmail.com
    <javascript:>> wrote:

        Thanks for your help Enrique.  I have attached the file.  In
        column "D" "Forecast_Date" is the column I want to apply the
        code to.  I have added a command button I would like to click
        on to have the code run. If you double click in a cell under
        column "D" you will see there is a date stamp.  No matter how
        I format it the date stamp remains.   This is a small sample
        of many reports I pull in a day and have to review the data.
        Removing the date stamp quickly will make life so much easier
        for me.
        Thanks again for your help.

        On Thursday, July 11, 2013 10:37:12 AM UTC-5, Enrique Martin
        wrote:

            Please share your file mentioning all your
            requirements..I'll try..

            On 7/8/13, srsev6 <srs...@gmail.com> wrote:
            > Thank you Enrique.  How do I set this up in a code to be
            able to use in a
            > command button?
            >
            > I am familiar with codes in visual basic but not an
            expert by any means in
            > writing them.
            >
            >
            >
            >
            > On Wednesday, July 3, 2013 7:15:00 PM UTC-5, Enrique
            Martin wrote:
            >
            >> you can use = text(cell,"dd mmm yyyy"), this will give
            time in text
            >> format.
            >>
            >>
            >> On Thu, Jul 4, 2013 at 3:17 AM, srsev6 <srs...@gmail.com
            >> <javascript:>>wrote:
            >>
            >>> Hi all,
            >>>
            >>> I have already posted this once but can not locate it
            so I apologize for
            >>>
            >>> the duplicate post.
            >>>
            >>>
            >>> I hope someone can answer my question.  I run dates
            out of a database
            >>> which uses access.  The dates I pull out have a
            timestamp.  The timestamp
            >>>
            >>> hinders my formulas in my excel spreadsheets.  I pull
            hundreds of dates
            >>> at
            >>> one time.  Is there a macro I can use in a template
            that will remove the
            >>>
            >>> timestamp from the date on a range of cells so I don't
            have to keep using
            >>>
            >>> =int(cell)?  I would like to create an excel template
            that has a command
            >>>
            >>> button I can click and run to remove the timestamp.
            >>>
            >>> Thank you all for your help.
            >>>
            >>> SRSEV6
            >>>
            >>> --
            >>> Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do
            you wanna be? It’s
            >>>
            >>> =TIME(2,DO:IT,N:OW) ! Join official Facebook page of
            this forum @
            >>> https://www.facebook.com/discussexcel
            <https://www.facebook.com/discussexcel>
            >>>
            >>> FORUM RULES
            >>>
            >>> 1) Use concise, accurate thread titles. Poor thread
            titles, like Please
            >>> Help, Urgent, Need Help, Formula Problem, Code
            Problem, and Need Advice
            >>> will not get quick attention or may not be answered.
            >>> 2) Don't post a question in the thread of another member.
            >>> 3) Don't post questions regarding breaking or
            bypassing any security
            >>> measure.
            >>> 4) Acknowledge the responses you receive, good or bad.
            >>> 5) Jobs posting is not allowed.
            >>> 6) Sharing copyrighted material and their links is not
            allowed.
            >>>
            >>> NOTE : Don't ever post confidential data in a
            workbook. Forum owners and
            >>>
            >>> members are not responsible for any loss.
            >>> ---
            >>> You received this message because you are subscribed
            to the Google Groups
            >>>
            >>> "MS EXCEL AND VBA MACROS" group.
            >>> To unsubscribe from this group and stop receiving
            emails from it, send an
            >>>
            >>> email to excel-macros...@googlegroups.com <javascript:>.
            >>> To post to this group, send email to
            >>> excel-...@googlegroups.com<javascript:>
            >>> .
            >>> Visit this group at
            http://groups.google.com/group/excel-macros
            <http://groups.google.com/group/excel-macros>.
            >>> For more options, visit
            https://groups.google.com/groups/opt_out
            <https://groups.google.com/groups/opt_out>.
            >>>
            >>>
            >>>
            >>
            >>
            >>
            >> --
            >> Regards,
            >> Anoop
            >> Sr. Developer
            >> Facebook ID - https://www.facebook.com/anooop.k.sharma
            <https://www.facebook.com/anooop.k.sharma>
            >>
            >
            > --
            > Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do
            you wanna be? It’s
            > =TIME(2,DO:IT,N:OW) ! Join official Facebook page of
            this forum @
            > https://www.facebook.com/discussexcel
            <https://www.facebook.com/discussexcel>
            >
            > FORUM RULES
            >
            > 1) Use concise, accurate thread titles. Poor thread
            titles, like Please
            > Help, Urgent, Need Help, Formula Problem, Code Problem,
            and Need Advice will
            > not get quick attention or may not be answered.
            > 2) Don't post a question in the thread of another member.
            > 3) Don't post questions regarding breaking or bypassing
            any security
            > measure.
            > 4) Acknowledge the responses you receive, good or bad.
            > 5) Jobs posting is not allowed.
            > 6) Sharing copyrighted material and their links is not
            allowed.
            >
            > NOTE  : Don't ever post confidential data in a workbook.
            Forum owners and
            > members are not responsible for any loss.
            > ---
            > You received this message because you are subscribed to
            the Google Groups
            > "MS EXCEL AND VBA MACROS" group.
            > To unsubscribe from this group and stop receiving emails
            from it, send an
            > email to excel-macros...@googlegroups.com.
            > To post to this group, send email to
            excel-...@googlegroups.com.
            > Visit this group at
            http://groups.google.com/group/excel-macros
            <http://groups.google.com/group/excel-macros>.
            > For more options, visit
            https://groups.google.com/groups/opt_out
            <https://groups.google.com/groups/opt_out>.
            >
            >
            >


-- Regards,
            Anoop
            Sr. Developer
            Facebook ID - https://www.facebook.com/anooop.k.sharma
            <https://www.facebook.com/anooop.k.sharma>

-- Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you
        wanna be? It’s =TIME(2,DO:IT,N:OW) ! Join official Facebook
        page of this forum @ https://www.facebook.com/discussexcel
        <https://www.facebook.com/discussexcel>

        FORUM RULES

        1) Use concise, accurate thread titles. Poor thread titles,
        like Please Help, Urgent, Need Help, Formula Problem, Code
        Problem, and Need Advice will not get quick attention or may
        not be answered.
        2) Don't post a question in the thread of another member.
        3) Don't post questions regarding breaking or bypassing any
        security measure.
        4) Acknowledge the responses you receive, good or bad.
        5) Jobs posting is not allowed.
        6) Sharing copyrighted material and their links is not allowed.

        NOTE : Don't ever post confidential data in a workbook. Forum
        owners and members are not responsible for any loss.
        ---
        You received this message because you are subscribed to the
        Google Groups "MS EXCEL AND VBA MACROS" group.
        To unsubscribe from this group and stop receiving emails from
        it, send an email to excel-macros...@googlegroups.com
        <javascript:>.
        To post to this group, send email to
        excel-...@googlegroups.com <javascript:>.
        Visit this group at
        http://groups.google.com/group/excel-macros
        <http://groups.google.com/group/excel-macros>.
        For more options, visit
        https://groups.google.com/groups/opt_out
        <https://groups.google.com/groups/opt_out>.





-- *Regards*
    **
    *Ashish Koul*


    */Visit/*
    */_My Excel Blog <http://www.excelvbamacros.com/>_/*
    Like Us on Facebook
    <http://www.facebook.com/pages/Excel-VBA-Codes-Macros/151803898222297>
    Join Us on Facebook <http://www.facebook.com/groups/163491717053198/>


    PBefore printing, think about the environment.

--
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ https://www.facebook.com/discussexcel

FORUM RULES

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.

NOTE : Don't ever post confidential data in a workbook. Forum owners and members are not responsible for any loss.
---
You received this message because you are subscribed to the Google Groups "MS EXCEL AND VBA MACROS" group. To unsubscribe from this group and stop receiving emails from it, send an email to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros.
For more options, visit https://groups.google.com/groups/opt_out.



--
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.

NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- You received this message because you are subscribed to the Google Groups "MS EXCEL AND VBA MACROS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to