473,325 Members | 2,308 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

Merge cell in Excel programmatically

HI,

i need to merger two cells if the values is exceeds the width of the cells.

for example i have string like "Internet" so it will fir in single cell. if have string like"Internet protected level is off" for this i need merge the automatically i dont want wrap with the same

can any one provide solution for this.
thanks in advance
Aug 19 '11 #1
2 9698
Hello, Nagarajan,

Here is a simple example. I hope this gives you an idea about how to proceed.

Dim xlaTest As New Excel.Application
xlaTest.Visible = True
Dim wbkTest As Excel.Workbook = xlaTest.Workbooks.Open("D:\Tests\VB Trials\ExcelTests\TestWorkbook.xls")
Dim wshTest As Excel.Worksheet = DirectCast(wbkTest.Worksheets("Sheet1"), Excel.Worksheet)

wshTest.Range("F3:G3").MergeCells = True

Cheers,
Randy
Aug 20 '11 #2
HI Randy

I already found the solution.
thanks for your effort
Aug 22 '11 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: middletree | last post by:
What ASP code can I use, for an ASP-generated spreadsheet, to force a cell to wrap if the content is longer than the width I have specified for that cell?
4
by: Mark C | last post by:
I currently have an Excel spreadsheet with numerous text boxes and check boxes that I want to populate with data from an Access 97 database. I have used Excel automation in Access before but only...
0
by: Thomas | last post by:
Hey All, I am doing a mail merge with Excel and C#, the problem i am having is that my excel workbook has 5 worksheets in it. Is there a way to set which sheet the mail merghe should use. As it...
1
by: GG | last post by:
Have this code but does not delete right columns. When I ran the folllowing code only columns 14, and 15 is deleted.Col 12 and 13 are still there. Any ideas? Thanks for (int colDel = 12;...
1
by: Samuel Shulman | last post by:
Any method to make a cell editable programmatically The problem is that if the user entered a value which is not valid then instead of ignoring the value and explaining the user what was wrong ...
0
by: oaksong | last post by:
Splitting cells is common to every IDE that manipulates HTML that I've worked with. I'm appalled that .NET seems incapable of providing that funcitonality. There was a conversation last December on...
6
by: Gunawan | last post by:
Dear All, I have create an excel (COM Object) using this code Excel.Application xls = new Excel.Application(); but I can not remove it from memory although I have using close and quit ...
1
by: Dranizz | last post by:
I want to set the value of a cell in a datagridview. DatagridView.CurrentRow.Cells(CEllName).value = "Blabla" When I do this in code and when it's the first cell I edit in a new row, it does...
3
by: Tequilaman | last post by:
Here comes are real tricky one: I'm approaching a project that seems impossible at first sight. I want to merge an Excel list where I find who will get which kind of information by email, with a...
0
by: Nico125 | last post by:
Good afternoon, I am trying to develop a macro to merge a Excel sheet to a PPT. At this stage, I can merge it only if the text is in a "Text Box" but not into a table in the PPT. Could you...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.