Merge macro with unknown value

jose001

Board Regular
Joined
Mar 27, 2006
Messages
103
Hi All,

Could anyone take a look at this snippet of code and wokout what I'm doing wrong. Its copying the value of A2 down as far as the last filled cell in column four just fine but I can't get it to merge cells i.e from b2: b...what ever is the value for D. I have tried using selection but that doesn't work either

Code:
'Formating
LimitD = Cells(Rows.Count, 4).End(xlUp).Row
Range("B2:B" & LimitD).MergeCells = True
Range("C2:C" & LimitD).MergeCells = True
Range("A2:A" & LimitD).Value = Range("A2").Value

Jose
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Hi
I have used your code (without any change) and it merges col B and C till the last row of D (& fills col A too).
Ravi
 
Upvote 0

Forum statistics

Threads
1,214,791
Messages
6,121,611
Members
449,038
Latest member
apwr

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