我的 excel 表在右侧单元格中有数据值,所以它就像
+---+--------+---------------------+
| | A | B |
+---+--------+---------------------+
| 1 | School | newyork high school |
| 2 | Head | Mr john |
| 3 | phone | 0191919 |
| 4 | email | john@school.com |
+---+--------+---------------------+
单个单元格中的学校名称,然后其他数据位于单元格旁边。我想垂直排列它们
+---+---------------------+---------+---------+-----------------+
| | A | B | C | D |
+---+---------------------+---------+---------+-----------------+
| 1 | School | Head | Phone | Email |
| 2 | newyork high school | Mr john | 0191919 | john@school.com |
+---+---------------------+---------+---------+-----------------+
我正在尝试以下列方式获取下一个单元格的值。
Dim cell As Range
For Each cell In Range("a1:a40")
If cell.Value = school Then
Range("E3").Value = cell.Offset(1, 0).Value
Next