Re: open to first blank cell in col B, then post current dat
Howdy,
Because you are making the manual entry in column B first, this requires two seperate routines. The first assumes the sheet you want to open up to is named Sheet1. (Change that to suit.)
This goes into the ThisWorkbook module.
<font face=Courier New><SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> Workbook_Open()
Sheets("Sheet1").Select
<SPAN style="color:#00007F">If</SPAN> [B6] = "" <SPAN style="color:#00007F">Then</SPAN>
[B6].Select
<SPAN style="color:#00007F">Exit</SPAN> <SPAN style="color:#00007F">Sub</SPAN>
<SPAN style="color:#00007F">ElseIf</SPAN> [B7] = "" <SPAN style="color:#00007F">Then</SPAN>
[B7].Select
<SPAN style="color:#00007F">Exit</SPAN> <SPAN style="color:#00007F">Sub</SPAN>
Else: [B6].End(xlDown)(2, 1).Select
End <SPAN style="color:#00007F">If</SPAN>
End <SPAN style="color:#00007F">Sub</SPAN></FONT>
This one goes into the Sheet module for the sheet of interest.
<font face=Courier New><SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> Worksheet_Change(<SPAN style="color:#00007F">ByVal</SPAN> Target <SPAN style="color:#00007F">As</SPAN> Range)
<SPAN style="color:#00007F">If</SPAN> Target.Column <> 2 Or _
Target.Count > 1 Or _
Target = vbNullString <SPAN style="color:#00007F">Then</SPAN> <SPAN style="color:#00007F">Exit</SPAN> <SPAN style="color:#00007F">Sub</SPAN>
Target.Offset(, -1).Value = <SPAN style="color:#00007F">Date</SPAN>
Target.Offset(, 3).Select
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN></FONT>
This will do what you've asked.
Hope it helps,
Dan