+ Reply to Thread
Results 1 to 7 of 7

copy paste transpose data range into merged cells

Hybrid View

  1. #1
    Registered User
    Join Date
    06-03-2014
    MS-Off Ver
    Office365
    Posts
    58

    copy paste transpose data range into merged cells

    'BLOCK3

    Range("AD38").Value = Range("AH4").Value
    Range("AD39").Value = Range("AI4").Value
    Range("AD40").Value = Range("AJ4").Value
    Range("AD41").Value = Range("AK4").Value
    Range("AD42").Value = Range("AL4").Value
    Range("AD43").Value = Range("AM4").Value
    Range("AD44").Value = Range("AN4").Value



    Rob
    Last edited by Robn02; 10-23-2017 at 10:04 AM. Reason: misleading title

  2. #2
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,271

    Re: need to refine this macro please

    Here you have it ... but who of us has a refinery to do it ...
    Sub refine()
        'Range("AD38").Value = Range("AH4").Value
        'Range("AD39").Value = Range("AI4").Value
        'Range("AD40").Value = Range("AJ4").Value
        'Range("AD41").Value = Range("AK4").Value
        'Range("AD42").Value = Range("AL4").Value
        'Range("AD43").Value = Range("AM4").Value
        'Range("AD44").Value = Range("AN4").Value
        
        Range("AD38:AD44").Value = Application.Transpose(Range("AH4:AN4"))
    End Sub
    Last edited by mjr veverka; 10-21-2017 at 08:31 PM.

  3. #3
    Registered User
    Join Date
    06-03-2014
    MS-Off Ver
    Office365
    Posts
    58

    Re: need to refine this macro please

    Thank you !
    How do I get this to paste to merged cells? or is that bad practice?
    Rob

  4. #4
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,271

    Re: need to refine this macro please

    Quote Originally Posted by Robn02 View Post
    How do I get this to paste to merged cells?
    e.g. in this way, but you will lose some of the data.
    This is "the beauty" of the merged cells.

    Sub refine()
        'Range("AD38").Value = Range("AH4").Value
        'Range("AD39").Value = Range("AI4").Value
        'Range("AD40").Value = Range("AJ4").Value
        'Range("AD41").Value = Range("AK4").Value
        'Range("AD42").Value = Range("AL4").Value
        'Range("AD43").Value = Range("AM4").Value
        'Range("AD44").Value = Range("AN4").Value
        
        Range("AD38:AD44").Value = Application.Transpose(Range("AH4:AN4"))
        
        'With merged cells, but you will lose some of the data
        Application.DisplayAlerts = False
        Range("AD10:AD16").MergeCells = False
        Range("AD10:AD16").Value = Application.Transpose(Range("AH4:AN4"))
        Range("AD10:AD16").MergeCells = True
        Application.DisplayAlerts = True
    End Sub
    Quote Originally Posted by Robn02 View Post
    or is that bad practice?
    It depends on what you want to achieve and do you care about all the data or not ?

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: need to refine this macro please

    Please take a moment to read the forum rules and then amend your thread title to something descriptive of your problem - not what you think the answer might be. (think google search terms?). Once you have done this please send me a PM and I will remove this request. (Also, include a link to your thread - copy from the address bar)

    Many members search our previous posts, and thread titles play a big part of the search. I doubt anybody would do a search based on your title?

    To change a Title on your post, click EDIT POST then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.

    (note: this change is not optional )
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  6. #6
    Registered User
    Join Date
    06-03-2014
    MS-Off Ver
    Office365
    Posts
    58

    Re: need to refine this macro please

    Thank you. I'll drop this route and rethink it.

  7. #7
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,697

    Re: need to refine this macro please

    Merged cells are indeed "bad" practice. Use "Center Across Selection" instead.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] need to refine display of formula
    By IanJS in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-30-2017, 06:12 AM
  2. [SOLVED] Refine yes no if statement to include Blank
    By nigelog in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-16-2016, 12:28 PM
  3. Will a macro help to refine the daily raw customer data I receive? **SOLVED**
    By michaelDDW in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 01-25-2016, 01:02 PM
  4. [SOLVED] Looking to refine my multiple lookup formula
    By Josephrandall in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-01-2015, 12:18 PM
  5. Excel 2007 : Refine a countif formula
    By joesport5 in forum Excel General
    Replies: 3
    Last Post: 04-23-2010, 02:53 PM
  6. macro to refine a set of values
    By kroz in forum Excel General
    Replies: 6
    Last Post: 09-26-2009, 02:45 AM
  7. This piece of code is very slow - please help refine
    By kostas in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-18-2009, 10:56 AM

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