Please tell me how, using cells , to determine if the cell is merged with another. In fact, I need to unload the names of the rows into the form (in the ComboBox), but these names refer to several rows at once (that is, the cells are merged vertically).

    1 answer 1

    The task is not completely clear. Check if the cell is merged with another (s):

     If Worksheets("Лист1").Cells(1, 3).MergeCells Then MsgBox "Π’Π°ΠΊΠΈ Π΄Π°!" 

    When merging, the value of the cells, except the left top, is lost. In this case, to create a list for the ComboBox, it is not necessary to check whether the cells are merged; it is enough to check the cells for the presence of data. The code that creates the list of the form element:

     Private Sub UserForm_Initialize() Dim Rng As Range Dim n ' ΡΠΎΠ·Π΄Π°Ρ‚ΡŒ Π²Ρ‹ΠΏΠ°Π΄Π°ΡŽΡ‰ΠΈΠΉ список With Worksheets("Лист1") Set Rng = .Range("C1:H4") ' ΠΏΡ€ΠΈΡΠ²ΠΎΠΈΡ‚ΡŒ ΠΏΠ΅Ρ€Π΅ΠΌΠ΅Π½Π½ΠΎΠΉ Π΄ΠΈΠ°ΠΏΠ°Π·ΠΎΠ½ "шапки" Ρ‚Π°Π±Π»ΠΈΡ†Ρ‹ End With ' Ρ†ΠΈΠΊΠ» ΠΏΠΎ ячСйкам For Each n In Rng.Value If n <> "" Then ' Ссли Π² ячСйкС Π΅ΡΡ‚ΡŒ Π΄Π°Π½Π½Ρ‹Π΅ Me.ComboBox1.AddItem n ' Π΄ΠΎΠ±Π°Π²ΠΈΡ‚ΡŒ строку Π² список End If Next n End Sub 

    PS In the calculation tables, try not to merge cells if possible, there may be problems with calculations.