Pasting values into merged cells?

RPM7

Board Regular
Joined
Nov 28, 2007
Messages
191
Is there any reason why you cannot copy the values from a single cell and paste the values into 2 merged cells? I have a macro running that resets my sheet to its original state but it won't fill the info into the merged cells. The merged cells have a data validation drop down menu so I don't want to have to split the cells up and align the text to centre across selection.
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Say that you want to copy the cell A2 into the merged cells C2/D2.

You can use any of these:
Code:
Sub foo()
    
    Range("A2").Copy Range("C2:D2")
    
    Range("A2").Copy Range("C2").MergeArea
     
    Range("C2").Value = Range("A2").Value
    
End Sub

Hope that helps...
 
Upvote 0
Thanks for the replies.

I'm actually copying from sheet 3 and pasting in sheet 1.
How would you work that into the code?

Sheets("Sheet3").Select
Range("r35").Select
Selection.Copy
Sheets("Sheet1").Select
Range("G8:h8").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
 
Upvote 0
Using the third example, you can replace all of that code with this:
Code:
Sub foo()
    Sheets("Sheet1").Range("G8").Value = Sheets("Sheet3").Range("r35").Value
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,054
Messages
6,122,895
Members
449,097
Latest member
dbomb1414

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top