VBA merge cell

Chaozfate

Board Regular
Joined
Mar 15, 2017
Messages
71
Dear All,

I m having this vba running, basically copy D3:H6 into the last row without data.

VBA Code:
Sub CR()
Sheets("CR").Range("D3:H6").Copy
lastrowCR = Sheets("CR").Range("D35").End(xlUp).Row
Sheets("CR").Activate
Sheets("CR").Cells(lastrowCR + 4, 4).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
End Sub

My question is within the range (D3:H6), (F3:F6) is a merged cells, and i wish the excel could paste the exact info into the last row without data, as well as merge the F+4 cells.

Can anyone help with my request?
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Not sure what you mean by pasting "without data". Do you mean without formulas?

Here is a code that will do what I think you are asking for....

VBA Code:
Sub Chaozfate()
Dim lastRow As Long, strCells As String
With Sheets("CR")
    lastRow = .Cells(.Rows.Count, 4).End(xlUp).Row + 4
    .Range("D3:H6").Copy
    .Cells(lastRow, 4).PasteSpecial
    strCells = .Cells(lastRow, 4).Address & ":" & .Cells(lastRow + 3, 7).Address
    .Range(strCells).Value = .Range(strCells).Value
End With
End Sub
 
Upvote 0
Sorry, did not make it clear, was writing in my own language.... by last row without data = i am referring to next empty row... bu

I tried your code, it successfully merge the cells as intended, however, i forgot to inform that D3:H6 are actually formulated. My apologies.
So when i tried to copy paste, the pasted data are formulated and showing wrong result. I tried inserted the paste as value code, end up the merged cells cannot be pasted as merged.
 
Upvote 0

Forum statistics

Threads
1,215,635
Messages
6,125,942
Members
449,275
Latest member
jacob_mcbride

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