Excel VBA USERFORMS #8 Using IIf Function in VBA - Easier!

preview_player
Показать описание

Fantastic Developer Tools:
Рекомендации по теме
Комментарии
Автор

It's sad that only few people watch your videos but I wanna tell you that you are a great teacher and it's very easy to follow. I learned alot please keep up the good work!

BuckstarrZ
Автор

Much easier to understand your shortcut approach in using IIF. Have a great day, Dan thanks.

aircooledcondenser
Автор

Gladly i found this video. it helps me alot. As a beginner in this whole VBA thing, i should say that this tutorial is great and you did it really well. U are simply just make it looks fun. Keep up the good work Dan.

agushatomo
Автор

PerfectPotion, thanks for your comments! Yes, it's absolutely not the best choice for every situation. Great points! I use it sometimes when there's only a simple true and a simple false I want to get across and save screen real estate at the same time. Decent for copy-paste scenarios as well. Have a great day sir. thanks again! Dan

ExcelVbaIsFun
Автор

Merry Christmas everyone. I hope God blesses you richly this upcoming year. Remember, you ARE a success!! Believe it, be it! Blessings my friends!! Dan

ExcelVbaIsFun
Автор

I would still recommend If Else instead of IIf (inline if) in most cases. With If and Else, if your condition is true, then only the If block executes, and if not, then only the Else block executes. Since IIf is a function, all of its arguments are evaluated before being sent to it, which is not only more work for the computer, but you can't use IIf for error checking if the argument whose evaluation you are trying to avoid produces an error.

PerfectPotion
Автор

Thanks a lot BuckstarrZ! I appreciate that and I sure will!
Dan

ExcelVbaIsFun
Автор

Thanks Dan. I would like to ask about combo box, just in case you have time, appreciate very much from your helpful input.my question is: i have combobox1 and combobox2 I would like to populate combobox2 based on indirect function relative to combobox1.if its ok, i will send the file to you.

aircooledcondenser
Автор

help i'm really new at vba, im trying to set up my first userform. i have 9 txt boxes representing col a, b, c, d, e ... then I have a listbox showing a named range in sheet1, the list is set to multiselect and the check boxes are visable. The textboxes to cells works but i'm trying to get a delete row button to delete the selected rows in the list, i'm pulling out my hair because I can't get it to work. 
this is my build:

Option Explicit

Private Sub CommandButton1_Click()
Dim irow As Long
Dim ws As Worksheet
Set ws = Worksheets("Sheet1")
'find first row in database
irow = ws.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
With ws
.Range("A" & irow) = TextBox1.Value
.Range("B" & irow) = TextBox2.Value
.Range("C" & irow) = TextBox3.Value
.Range("D" & irow) = TextBox4.Value
.Range("E" & irow) = TextBox5.Value
.Range("F" & irow) = ComboBox1.Value
.Range("G" & irow) = TextBox7.Value
.Range("H" & irow) = TextBox8.Value
.Range("I" & irow) = TextBox9.Value
End With
TextBox1.Value = ""
TextBox2.Value = ""
TextBox3.Value = ""
TextBox4.Value = ""
TextBox5.Value = ""
ComboBox1.Value = ""
TextBox7.Value = ""
TextBox8.Value = ""
TextBox9.Value = ""
End Sub

Private Sub CommandButton2_Click()
 
End Sub

Private Sub ListBox1_Click()

End Sub

Private Sub UserForm_Initialize()
  TextBox10.Value = Format(Date, "mm/dd/yyyy") & "   " & Format(Time, "hh:mm:ss")
  
End Sub

Private Sub CommandButton4_Click()
  
End Sub

Private Sub CommandButton3_Click()
'reset form
Unload Me
UserForm1.Show
End Sub

Private Sub Sheet1_Click()

End Sub

Private Sub TextBox10_Change()

End Sub

Private Sub TextBox4_Change()

End Sub

Private Sub TextBox7_Change()

End Sub

Private Sub TextBox8_Change()

End Sub

Private Sub UserForm_Click()

End Sub

Private Function delete_row()

End Function

please, please, please, please, please with a cherry on top... HELP ME make delete work.

mrmiggins