Fill Cell to the right

  • Thread starter Thread starter John in Surrey
  • Start date Start date
J

John in Surrey

Hi folks
I wish to paste data from a form into the first aviable row (bed) of
our ward database...

Private Sub cmdAdmitPatient_Click()
For Each c In Worksheets("admission").Range("B5:B29")
If c.Value = " " Or c.Value = "" Then
c.Value = txtName.Value
'<cell to the right> = txtDateOfBirth.Value
'<cell to the right again> = txtNextOfKin
Exit For
End If
Next
End Sub

as you can see, Ive found the first blank row / bed and pasted in the
patient name, how do I move to the right one cell to paste the DOB
then ditto again for the next field

thanks
john
Images of home (NZ)
http://www.titahi-bay.co.nz/home
What we are up to in the UK
http://www.titahi-bay.co.nz
 
Private Sub cmdAdmitPatient_Click()
dim c as range
For Each c In Worksheets("admission").Range("B5:B29").cells
If trim(c.Value) = "" Then
c.Value = txtName.Value
c.offset(0,1).value = txtDateOfBirth.Value
c.offset(0,2).value = txtNextOfKin
Exit For
End If
Next c
End Sub
 
Back
Top