Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Merge Cell in Excel

Tags:

merge

vb.net

cell

How to merge cells using Cell and not Range in vb.net

I'll try this code but it doesn't work

excelSheet.Cells(1, 10).Merge()

Can anyone help me..

like image 637
Mark Avatar asked Nov 23 '25 09:11

Mark


1 Answers

The cells property of a worksheet refers to a single cell. So you are trying to merge just the cell at A10. As its already one cell, this doesn't do anything. I'm not sure you can do it with just the Cells property, as it will always be one cell only. Why are you avoiding Range?

This uses range, but would still use the cells property to target the range constraints

excelSheet.Range(excelSheet.Cells(1, 1),excelSheet.Cells(1, 10)).Merge

Also, I think the command is Merge, not Merge(), at least when I run it.

Sorry if that isn't helpful, give us some more details and I'll look harder if that doesn't work for you.

like image 147
goggin13 Avatar answered Nov 24 '25 23:11

goggin13



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!