Yesterday I posted the snippet of code that is listed
below. Surely there must be a seasoned programmer out there that has
an idea of how to tackle this, even if the below code is totally
changed. This is what I want to do using VBA code:
I have 5 columns, filled with data on my Excel worksheet.
I have a form made up. To fill a textbox on my form I want to be able
to take data from the worksheet with the following criteria:
If column (c) value = "admission" AND column (d) value = "Home" and
a checkbox on my form is checked:
Then the count of the rows that have column (c) with the specified
value AND column (D) with the specified value, will be totalled and
placed in the textbox on the form.
Here is a snippet of code I had done which will count and put the
total in the textbox, but I cannot figure out how to add in the other
criteria of the column (c) value = "admission". The way it is now, it
is totalling all rows in column (D) with a value of "Home". I cannot
figure out how to have multiple criteria being met.
Dim Ct As Integer
Ct = 0
If ckHome2 = True Then
Range("d2").Select
Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If
If ActiveCell.Value = "Home" Then
Ct = Ct + 1
txtHome2.Text = Ct
End If
I have been working on this for weeks to no avail. Can someone
please, please, please, please help me with this. Thanks.
Bookmarks