0
我试图将excel文件添加到访问数据库。我想按房间号搜索每个房间名称。现在,如果你查询的房间号,只配备了包含房号行,即使下面的房间号的行还包含该同一房间内的数据......像这样:用相似的值填充列的空格
http://i802.photobucket.com/albums/yy304/Growler2009/Database_Fill_In.jpg
因此,我想要做的是编写一个脚本,它将扫描房间号码列(第1列)......每次脚本登录到一个唯一的房间号码时,它会填充下面的空白处相同的房间号码。
后: http://i802.photobucket.com/albums/yy304/Growler2009/BlankSpace_FillIn.jpg
到目前为止,我已经写了这个测试脚本...但它似乎没有工作...任何提示? 谢谢!
RoomNumber = Array(1, 2, 3, 4, 5)
For RoomNumberRow = 1 To 5
For ColIndex = 1 To 5
If Cells(RoomNumberRow, ColIndex).Value = RoomNumber(RoomNumberRow) Then
'Move down a cell
ActiveCell.Offset(1, 0).Select
'changes that cell to the same room number
Cells.Value = RoomNumber(RoomNumberRow)
End If
Next RoomNumberRow