+ Reply to Thread
Results 1 to 17 of 17

Data format copy

  1. #1
    Registered User
    Join Date
    06-13-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    61

    Data format copy

    Hi experts,

    I do have a following code for copying a value from another sheet..

    {code}
    Worksheets("Summary").Cells(nNextRow, "N") = .Cells(nRow, "D")
    {code}

    the above is copying proper the value of D...

    Cells(nRow, "D") is date column. I need to extract mont-yy format data only...

    for example if D = 27/8/2012 then i should extract in the format of Aug-2012 and asign that value to left side row...

    how can i change above for my requirement..

    thanks

  2. #2
    Valued Forum Contributor Steffen Thomsen's Avatar
    Join Date
    10-15-2010
    Location
    Kolding, Denmark
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    953

    Re: Data format copy

    The use

    Please Login or Register  to view this content.
    Please take time to read the forum rules

  3. #3
    Registered User
    Join Date
    06-13-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    61

    Re: Data format copy

    Hi Steffen,

    thank you so much for solution......

    still one more question will that copy background colour too.. if not can you please suggest code to copy background value that 'D' cell..

    thank you

  4. #4
    Valued Forum Contributor Steffen Thomsen's Avatar
    Join Date
    10-15-2010
    Location
    Kolding, Denmark
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    953

    Re: Data format copy

    Then i would do it like this

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    06-13-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    61

    Re: Data format copy

    Quote Originally Posted by Steffen Thomsen View Post
    Then i would do it like this

    Please Login or Register  to view this content.
    Thank you steffen,

    sorry..last one....please help

    i have another piece code like this..

    Worksheets("Summary").Cells(nNextRow, "N") = .Cells(nRow, "AB")

    for this value i need some if logic. means. Actually this "AB" col will contain any value between 0 and 9.
    now if AB value is 0 then I want to set value of "N" 'external', if any other number then i need to set N value as 'Internal'

    any help will be appreciated ..thank you..

  6. #6
    Registered User
    Join Date
    06-13-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    61

    Re: Data format copy

    Thank you steffen,



    sorry..last one....please help

    i have another piece code like this..

    Worksheets("Summary").Cells(nNextRow, "N") = .Cells(nRow, "AB")

    for this value i need some if logic. means. Actually this "AB" col will contain any value between 0 and 9.
    now if AB value is 0 then I want to set value of "N" 'external', if any other number then i need to set N value as 'Internal'
    once it copy external or intenral value, i need to pain background of "N" as some colour....


    any help will be appreciated ..thank you..
    Last edited by onenessboy; 07-10-2012 at 06:42 AM.

  7. #7
    Valued Forum Contributor Steffen Thomsen's Avatar
    Join Date
    10-15-2010
    Location
    Kolding, Denmark
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    953

    Re: Data format copy

    Hi,

    Then use an if statement

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    06-13-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    61

    Re: Data format copy

    Thank you will give a try......thanks for your time..

    i just added something in my last reply mean while you replied with latest reply...
    after copying external or internal values i need to paint that N row with some colour like interior colur with some colour...
    your suggestion please..

    mean while sorry, my earlier reply posted twice...accidentally

  9. #9
    Valued Forum Contributor Steffen Thomsen's Avatar
    Join Date
    10-15-2010
    Location
    Kolding, Denmark
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    953

    Re: Data format copy

    It's ok..

    Please Login or Register  to view this content.
    Try to piece together the macro, if you have any other questions then feel free to ask.

  10. #10
    Registered User
    Join Date
    06-13-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    61

    Re: Data format copy

    Quote Originally Posted by Steffen Thomsen View Post
    It's ok..

    Please Login or Register  to view this content.
    Try to piece together the macro, if you have any other questions then feel free to ask.
    Thank you steffen..will include this code...

    can we control alignment with macro after copying data. like we do with select cell --> Text alignement --> horizontal with Left indent and Vertical as 'Top',

    though i can do it manually for every copied row, can we use macro to control these functions..

  11. #11
    Valued Forum Contributor Steffen Thomsen's Avatar
    Join Date
    10-15-2010
    Location
    Kolding, Denmark
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    953

    Re: Data format copy

    Yes, you can do it by macro

    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    06-13-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    61

    Re: Data format copy

    Super thank you...

    I have placed some command button to execute above functionalites.....

    so..is it possible to place command button to excel toobar instead of having it on excel page some where..

  13. #13
    Valued Forum Contributor Steffen Thomsen's Avatar
    Join Date
    10-15-2010
    Location
    Kolding, Denmark
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    953

    Re: Data format copy

    I suggest you look at this page

    http://www.rondebruin.nl/ribbon.htm

  14. #14
    Valued Forum Contributor Steffen Thomsen's Avatar
    Join Date
    10-15-2010
    Location
    Kolding, Denmark
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    953

    Re: Data format copy


  15. #15
    Registered User
    Join Date
    06-13-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    61

    Re: Data format copy

    Hi

    Worksheets("Summary").Cells(nNextRow, "H") = Format(.Cells(nRow, "AE"), "Mon-YY")

    its fetching me like 12-Jun

    but i need in this format Jun-12 like this...

  16. #16
    Valued Forum Contributor Steffen Thomsen's Avatar
    Join Date
    10-15-2010
    Location
    Kolding, Denmark
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    953

    Re: Data format copy

    Try

    Please Login or Register  to view this content.

  17. #17
    Registered User
    Join Date
    06-13-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    61

    Re: Data format copy

    Quote Originally Posted by Steffen Thomsen View Post
    Try

    Please Login or Register  to view this content.
    No luck steffen, its still showing me same thing...

    anyway i just treid simple example in A1 i put value of 7/28/2012 then in B1 i wrote a formuale =format ("A1","mm-yyyy") says error..

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1