Results 1 to 4 of 4

Thread: Formatting Problem while copying data

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Forum Guru Rick Rothstein's Avatar
    Join Date
    Feb 2012
    Posts
    662
    Rep Power
    14
    Quote Originally Posted by princ_wns View Post
    How to copy data of merged cells into a cell. How it can be done from VBA.
    Your question is kind of vague and lacking in details, but see if this code line addresses your problem. Let's say your merged cells are C2:F3. You can reference that range either in its entirety or by an one or more set of cells within it for this method. So, you could use any one of the following to copy just the value in that merged range to another cell (for my example, I used cell D8 for the destination cell)...

    Code:
    Range("D8").Value = Range("C2:F3")(1).MergeArea.Value
    Code:
    Range("D8").Value = Range("E2:D3")(1).MergeArea.Value
    Code:
    Range("D8").Value = Range("C2")(1).MergeArea.Value
    Code:
    Range("D8").Value = Range("F3")(1).MergeArea.Value
    Code:
    Range("D8").Value = Range("D3")(1).MergeArea.Value
    All of the above copy just the value in the merged cells C2:F3 into the cell D8. So, using the setup I show above, any cell or cells in the merged area may be used to transfer the value in the merged area to another cell.
    Last edited by Rick Rothstein; 04-03-2012 at 07:34 PM.

Similar Threads

  1. Solve Block If Without End If Problem
    By jffryjsphbyn in forum Excel Help
    Replies: 3
    Last Post: 06-12-2013, 11:06 AM
  2. Replies: 8
    Last Post: 05-21-2013, 06:34 AM
  3. Copying formulas while keeping formating
    By Bradh in forum Excel Help
    Replies: 1
    Last Post: 12-02-2012, 11:32 AM
  4. Replies: 10
    Last Post: 11-27-2012, 08:27 PM
  5. copying data from multiple workbooks into another
    By rahulcoolz99 in forum Excel Help
    Replies: 1
    Last Post: 08-22-2012, 09:19 PM

Posting Permissions

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