0
我的Excel工作表在右邊的單元格的數據值,所以在單細胞它像Excel/VBA - 基於定位的多行對齊 - 如何檢查單元格值然後將值保存在另一個單元格中?
+---+--------+---------------------+
| | A | B |
+---+--------+---------------------+
| 1 | School | newyork high school |
| 2 | Head | Mr john |
| 3 | phone | 0191919 |
| 4 | email | [email protected] |
+---+--------+---------------------+
學校名稱,然後其他數據旁邊的單元格。我想將它們垂直排列,如
+---+---------------------+---------+---------+-----------------+
| | A | B | C | D |
+---+---------------------+---------+---------+-----------------+
| 1 | School | Head | Phone | Email |
| 2 | newyork high school | Mr john | 0191919 | [email protected] |
+---+---------------------+---------+---------+-----------------+
我試圖按照以下方式獲取下一個單元格的值。
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
它不工作:( –
http://postimg.org/image/tob7f571h/這裏是我的Excel格式 –
@RobertGarcia的截圖:請嘗試更新的答案 – IIIOXIII