Merging 2 cell

how I merge tow cell or more ?, is there any activity to be downloaded? if yes, how I do ?

and how I increase the cell wide ?

Hi @ah_kathema

Excel process scope
Use excel file
Invoke vba

Below is the text file

Sub MergeAndAdjust()
ActiveSheet.Range(“A1:B1”).Merge
Columns(“A:B”).ColumnWidth = 20
End Sub

Hope it helps!!

thanks, so much
do you have another activity?

I tried with your answer but I did not get what I want

Hi @ah_kathema

Input:


Output:

VBA Code:

Sub MergeAndSetWidth()
    ' Store the content of cells A1 and B1
    Dim cellContentA As Variant
    Dim cellContentB As Variant
    cellContentA = Range("A1").Value
    cellContentB = Range("B1").Value
    
    ' Clear the content of cells A1:B1
    Range("A1:B1").ClearContents

    ' Merge cells A1:B1
    Range("A1:B1").Merge
    
    ' Set the width for columns A to B (change 200 to your desired width)
    Columns("A:B").ColumnWidth = 20
    
    ' Restore the content to the merged cells
    Range("A1").Value = cellContentA & " " & cellContentB
End Sub

Excel Process Scope=> Use Excel File=> Invoke VBA Activity=> Paste the above code in text file and pass the text file path in Code File Path=> In Entry Method Name pass MergeAndSetWidth within double quotes.

Refer this below workflow

Hope it helps!!

thank you so much and your great clear explanation

1 Like

@ah_kathema

If you find the solution for your query please mark it as solution to close the loop.

Happy Automation

Regards

Hi @ah_kathema ,
You can use VBA code or use send hot key
regards,

what is hot key and how it is used, if you can explane how it is done in RPA

Hi @ah_kathema

Send hot keys is an classic activity and it resembles the keyboard short cuts in the modern activity. For using the keyboard short cuts or send hot keys activity please follow the below steps

Open Excel application scope to indicate the Excel file you are working with.
Use the “Select Range” activity to specify the range of cells you want to merge.
Add a “Send Hotkey” activity with the key “Alt + H” (to activate the Home tab).
Use another “Send Hotkey” activity with the key “M” (to activate the Merge & Center option).
Finally, add a “Send Hotkey” activity with the key “Enter” to confirm the merge.

Regards

great explanation, but hot activity does not appear in the program I have.

what shall do ?

Hi @ah_kathema

If you are using the modern activities then check for keyboard short keys activity

Regards

how I increase the width of a cell in excel

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.