Problem with merging cells

Diving_Dan

Board Regular
Joined
Oct 20, 2019
Messages
161
Hi all,

Having a nightmare this morning and not sure where I am going wrong with this code. Help as always is appreciated.

VBA Code:
With Sheets("Report")
.Range("A1:C1").merge
End With
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Much as I hate merged cells, what issues are you having as the code works fine for me?
 
Upvote 0
Nothing happens, the cells don't merge. When I type the code into VBA editor the "m" on merge does not capitalise and stays lowercase.
 
Upvote 0
Have you defined a variable with the name merge (or named a sub merge)?
 
Upvote 0
No i haven't defined any variable. Below is all the code for this portion.

VBA Code:
If cboTeam.Value = "A" And OptionRadio.Value = True Then
    
Application.ScreenUpdating = False
    
With Sheets("Report")
.Cells.Clear
.Range("A1:C1").merge
End With
    
End If

Application.ScreenUpdating = True
 
Upvote 0
Run the code below, does the text in the editor capitalise?
VBA Code:
Sub xxxx()
Dim Merge
End Sub
and do all the cells on Sheets("Report") clear with the code that you posted?
 
Upvote 0
I am afraid if you haven't named any variable or Sub as "merge" then I have no other ideas at present (and that is just for the capitalisation issue).
Maybe someone else will have an idea.
 
Upvote 0
I must have merge somewhere within some code somewhere as I have just tried it on a blank sheet and it works.
 
Upvote 0

Forum statistics

Threads
1,214,861
Messages
6,121,969
Members
449,059
Latest member
oculus

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