Mega Code Archive

 
Categories / VisualBasic Script / Word
 

Checks the number of rows and columns in the selection

Sub num()     With Selection         If .Columns.Count > 1 And .Rows.Count > 1 Then             MsgBox "Please select cells in only one row " _                 & "or only one column."             End         Else             If .Cells.Count > 1 Then                 If .Columns.Count > 1 Then                     .Cells.Delete ShiftCells:=wdDeleteCellsShiftUp                 Else                     .Cells.Delete ShiftCells:=wdDeleteCellsShiftLeft                 End If             Else                 .Cells.Delete ShiftCells:=wdDeleteCellsShiftLeft             End If         End If     End With End Sub