美好的一天,我是VBA编程的新手。需要专家:)VBA - 查找下一个空行
一些帮助后,我输入的日期,点击生成按钮的代码会发现在Excel中的日期,但即时通讯这个问题做了,这里是我的代码..
Dim Rng As Range
Dim FindDate As Date
FindDate = txtDate.Value
If Trim(FindDate) <> "" Then
With Sheets("Sheet2").Range("B:B")
Set Rng = .Find(What:=FindDate, After:=.Cells(.Cells.Count), LookIn:=xlValues, LookAt:=xlWhole, _
SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=True)
If Not Rng Is Nothing Then
Application.Goto Rng, True
Else
MsgBox "Nothing found"
End If
End With
End If
我的下一个问题是,我需要选择的日期旁边的空单元格。这里是一个屏幕截图
当找到日期时,'Rng'将被设置为匹配的单元格。如果你想查看值,或者只是使用诸如Cells(rsg.row,rng.column).value =“向左看”,你可以引用'rng.Row'和'rng.Column'。或者你可以使用'Offset'来'rng'。 –