Thread: if then else
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default if then else

Try this

Private Sub CmdSaveChanges_Click()
ActiveWorkbook.Sheets("Order").Activate

With Range("A1").End(xlDown)

.Offset(1, 0).Value = 123 'TextDate.Value

.Offset(1, 1) = 456 'ComboWebsite.Value

If NewCust Then

.Offset(1, 2).Value = "New Customer"

ElseIf ExistCust Then

.Offset(1, 2).Value = "Existing Customer"
End If
End With
End Sub


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Pam" wrote in message
...
I am trying to do a very simple statement, but vb6 keeps giving me errors
on
this line.
I want to search for the next available line (that is empty).
Here's my code, what have I done wrong? It is giving me the error on the
line after the If IsEmpty line.
Thanks
Pam

Private Sub CmdSaveChanges_Click()
ActiveWorkbook.Sheets("Order").Activate

Range("A1").Select

Do

If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If

Loop Until IsEmpty(ActiveCell) = True

ActiveCell.Value = TextDate.Value

ActiveCell.Offset(0, 1) = ComboWebsite.Value

If NewCust = True Then

ActiveCell.Offset(0, 2).Value = "New Customer"

ElseIf ExistCust = True Then

ActiveCell.Offset(0, 2).Value = "Existing Customer"

End If