if then else
This is actually all of the code for that sub, didn't post it all because
it's so long, but maybe it will explain what I'm doing more.
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
If NewOrder = True Then
ActiveCell.Offset(0, 3).Value = "New Order"
ElseIf ReOrder = True Then
ActiveCell.Offset(0, 3).Value = "ReOrder"
End If
ActiveCell.Offset(0, 4) = ContactName.Value
ActiveCell.Offset(0, 5) = Email.Value
ActiveCell.Offset(0, 6) = OldOrder.Value
ActiveCell.Offset(0, 7) = Rep.Value
ActiveCell.Offset(0, 8) = TxtBillName.Value
ActiveCell.Offset(0, 9) = TxtBillAdd1.Value
ActiveCell.Offset(0, 10) = TxtBillAdd2.Value
ActiveCell.Offset(0, 11) = TxtBillCity.Value
ActiveCell.Offset(0, 12) = TxtBillState.Value
ActiveCell.Offset(0, 13) = TxtBillCountry.Value
ActiveCell.Offset(0, 14) = TxtBillZip.Value
ActiveCell.Offset(0, 15) = TxtShipAdd1.Value
ActiveCell.Offset(0, 16) = TxtShipAdd2.Value
ActiveCell.Offset(0, 17) = TxtShipCity.Value
ActiveCell.Offset(0, 18) = TxtShipState.Value
ActiveCell.Offset(0, 19) = TxtShipCountry.Value
ActiveCell.Offset(0, 20) = TxtShipZip.Value
ActiveCell.Offset(0, 21) = ComboCCType.Value
ActiveCell.Offset(0, 22) = TextCC.Value
ActiveCell.Offset(0, 23) = TextCCExp.Value
ActiveCell.Offset(0, 24) = TextCCSec.Value
ActiveCell.Offset(0, 25) = ComboItem1.Value
ActiveCell.Offset(0, 26) = TxtItemQty1.Value
ActiveCell.Offset(0, 27) = TxtItemUnit1.Value
ActiveCell.Offset(0, 28) = TxtItemExt1.Value
ActiveCell.Offset(0, 29) = ComboItem2.Value
ActiveCell.Offset(0, 30) = TxtItemQty2.Value
ActiveCell.Offset(0, 31) = TxtItemUnit2.Value
ActiveCell.Offset(0, 32) = TxtItemExt2.Value
ActiveCell.Offset(0, 33) = ComboItem3.Value
ActiveCell.Offset(0, 34) = TxtItemQty3.Value
ActiveCell.Offset(0, 35) = TxtItemUnit3.Value
ActiveCell.Offset(0, 36) = TxtItemExt3.Value
ActiveCell.Offset(0, 37) = ComboItem4.Value
ActiveCell.Offset(0, 38) = TxtItemQty4.Value
ActiveCell.Offset(0, 39) = TxtItemUnit4.Value
ActiveCell.Offset(0, 40) = TxtItemExt4.Value
ActiveCell.Offset(0, 41) = ShipExt.Value
ActiveCell.Offset(0, 42) = SetupExt.Value
ActiveCell.Offset(0, 43) = DesignExt.Value
ActiveCell.Offset(0, 44) = RushExt.Value
ActiveCell.Offset(0, 45) = Colors.Value
ActiveCell.Offset(0, 46) = ComboAttach.Value
ActiveCell.Offset(0, 47) = ComboMaterial.Value
ActiveCell.Offset(0, 48) = ComboType.Value
ActiveCell.Offset(0, 49) = NumberOColors.Value
ActiveCell.Offset(0, 50) = instructions.Value
ActiveCell.Offset(0, 51) = ComboAttach.Value
ActiveCell.Offset(0, 52) = Factory.Value
ActiveCell.Offset(0, 53) = Artfile.Value
ActiveCell.Offset(0, 54) = ComboShip.Value
End Sub
"Mike H" wrote:
Pam
It finds the empty cell OK, if somewhat unconventionally, but is falling
over on the line:-
ActiveCell.Value = TextDate.Value
I assume here you are trying to enter a date so this line will do that
ActiveCell.Value = Date
It falls over again on the line
ActiveCell.Offset(0, 1) = ComboWebsite.Value
and I don't really understand what your trying to do here.
In the snippet of code given both Newcust and Existcust are not set so
neither of the if or else conditions are satisfied.
Mike
"Pam" wrote:
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
|