P
Pete
I have a user form that when a user right clicks on a cell a form pops up
and lets them select vendors from a drop down list. The vendors are
stored on a separate worksheet and does contain blanks. Everything works
fine except that if the user selects a blank from the list it some how is
not really blank. The reason I know this is that when I sort the list.
The blanks show at the top of the sorted list. I figured I could check
for "" and then set the cell to "" but that did not work. So just for the
heck of it I set the cell to NUL and it worked. My question is why won't
"" not work and NUL does work?
Private Sub Cancel_Click()
Unload Me
End Sub
Private Sub OkSubmit_Click()
If Vendor = "" Then
ActiveCell.Value = "" 'this does not work. Why?
ActiveCell.Value = nul 'but this does accomplish it. Why?
Else
ActiveCell.Value = UCase(Vendor)
End If
Unload Me
End Sub
Sub UserForm_Initialize()
'Selects info from Vendor List and puts in drop down box
Vendor.List = Sheets("Vendor List").Range("D433").Value
'if the active cell has nothing then select the first
'item from the vendor list
'else take the active cell and select it in upper case
If ActiveCell = "" Then
Vendor = Sheets("Vendor List").Range("D4")
Else
Vendor = UCase(ActiveCell)
End If
End Sub
and lets them select vendors from a drop down list. The vendors are
stored on a separate worksheet and does contain blanks. Everything works
fine except that if the user selects a blank from the list it some how is
not really blank. The reason I know this is that when I sort the list.
The blanks show at the top of the sorted list. I figured I could check
for "" and then set the cell to "" but that did not work. So just for the
heck of it I set the cell to NUL and it worked. My question is why won't
"" not work and NUL does work?
Private Sub Cancel_Click()
Unload Me
End Sub
Private Sub OkSubmit_Click()
If Vendor = "" Then
ActiveCell.Value = "" 'this does not work. Why?
ActiveCell.Value = nul 'but this does accomplish it. Why?
Else
ActiveCell.Value = UCase(Vendor)
End If
Unload Me
End Sub
Sub UserForm_Initialize()
'Selects info from Vendor List and puts in drop down box
Vendor.List = Sheets("Vendor List").Range("D433").Value
'if the active cell has nothing then select the first
'item from the vendor list
'else take the active cell and select it in upper case
If ActiveCell = "" Then
Vendor = Sheets("Vendor List").Range("D4")
Else
Vendor = UCase(ActiveCell)
End If
End Sub