View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
anon anon is offline
external usenet poster
 
Posts: 77
Default Find first empty row in a range

Hi,

I'm looking for my user to select a button which will take a date
entered in sheet 1 and find it in sheet 2. I then want to enter some
text in the column where the date was found.
However; I need to post the text in the first empty row in the next 13
rows below the date, excluding the row directly below the date. Eg. if
the date is found in a1 it will enter the text in the first empty row
between a3:a14. If the date is found in D20 it would paste text in the
first empty row in the range d21:d33.

I also need an action if there are no empty rows in this range ie. a
msg box to warn the user that the text has not been pasted.

I've started with some code as below;

RESULT = Application.InputBox("What date would you like to plan for?"
& vbNewLine & "Enter the date as dd/mm/yy", "Call planning date",
Type:=2)
If RESULT = "" Then
MsgBox ("You have not entered a valid date, please try again")
Else
sheets("planner").activate
activesheet.range("A1").activate
with activesheet
cells.find(what:=RESULT, After:=activecell, LookIn:=xlvALUES, LookAt:=
_
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:=False) _
'action if not found
else
'find first empty row in the next 14 rows below the found cell
excluding the row directly below the found cell
'if no empty rows do an action
'otherwise paste "FOUND" in the empty row
End Sub

Any help will be gratefully received. Thanks,