Excel – How to divide cells into two parts in Excel
microsoft-excel-2010vbaworksheet-function
For example I want to divide cell B2 into two parts, without inserting any new row or column. Please see the screenshot below:
Best Answer
It is not possible to split an Excel cell into smaller parts (rows, columns).
This concept exists in Word tables or in html, but not in Excel.
When designing a spreadsheet you need to start from the smallest unit in a table, which is a cell. As discussed in the comments to your question, you can merge cells to span several rows or several columns.
Merged cells introduce problems with aspects of data selection, though, so use them with caution. Instead of merging cells across several columns, it is often better to use the cell alignment "Center across selection".
I found IsNumeric(B) to be true for blank cells,
so I changed your If statement accordingly. This worked for me:
If IsNumeric(B) And B <> "" Then
Cells(B.Row, 9) = Cells(B.Row + 1, 8) & Cells(B.Row + 2, 8)
Cells(B.Row + 1, 8) = ""
Cells(B.Row + 2, 8) = ""
End If
If B.Row > 9 Then Exit For
Obviously 8 and 9 are the column numbers for H and I, respectively.
I added the
If B.Row > 9 Then Exit For
line because I had a problem with the loop not terminating; if
For Each B In ClientTable.Columns(2).Cells
works for you, you can take out the If B.Row > 9 Then Exit For.
Best Answer
It is not possible to split an Excel cell into smaller parts (rows, columns).
This concept exists in Word tables or in html, but not in Excel.
When designing a spreadsheet you need to start from the smallest unit in a table, which is a cell. As discussed in the comments to your question, you can merge cells to span several rows or several columns.
Merged cells introduce problems with aspects of data selection, though, so use them with caution. Instead of merging cells across several columns, it is often better to use the cell alignment "Center across selection".