View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
L. Howard L. Howard is offline
external usenet poster
 
Posts: 852
Default Dynamic Offset from an Application.Goto cell = Date or Time

Near the bottom of the code is a Application.Goto monthID statement. The offset lines shown there work but I need to do the following.

I want to offset from the GoTo cell:
1 column to the right and the first empty cell below row 5 = Time

In another macro I need to offset from the GoTo cell:
1 column left and the first empty cell below row 5 = Timee
2 columns left and the first empty cell below row 5 = Date

I am pretty sure if I see how any one of the offsets work, I can adapt the others. I can offset from the GoTo cell but I can't find how to make it dynamic AND add Date/Time

Thanks.
Howard


Sub Scan_Out_Check()

Dim scanIDout As Range
Dim eIDout As String
Dim monthID As Range
Dim LrUIo As Long
Dim LrMonth As Long
Dim sMsg$

eIDout = Sheets("UI").Cells(5, 10)

LrUIo = Sheets("UI").Cells(Rows.Count, "D").End(xlUp).Row

Set scanIDout = Sheets("UI").Range("D18:D" & LrUIo).Find(What:=eIDout, _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)

If Not scanIDout Is Nothing Then

scanIDout.Offset(, -2).Resize(1, 3).Copy Range("I" & Rows.Count).End(xlUp)(2)
scanIDout.Offset(, -2).Resize(1, 3).ClearContents
'Sheets(Format(Date, "mmm yy")).Cells(Rows.Count, "D").End(xlUp)(2) = Time

Set monthID = Sheets(Format(Date, "mmm yy")).Range("C2:BH2").Find(What:=eIDout, _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByColumns, _
SearchDirection:=xlNext, MatchCase:=False, _
SearchFormat:=False)

If Not monthID Is Nothing Then

Application.Goto monthID
'Application.Goto monthID.Offset(4, 1)
'Application.Goto monthID.Offset(25, 0)

Else

sMsg = "No match found!"
sMsg = sMsg & vbLf & vbLf
sMsg = sMsg & "Some text here."
MsgBox sMsg, vbExclamation
End If
End If
Sort_In_Scan
End Sub