S
Shakil Mian
Hi,
I have a worksheet that contains a series of drop down lists (cells
B2, B3, B4... Bn). The drop down list contains YES, NO values as
options. I select YES from a list. Then code written in VBA is
executed(when i click the "Check" button) that tries to read values
from the cells that contain the values. When the code finds "YES" a
msgbox pops up with the message "Found: YES". The code does the same
for the next cell down untill a blank cell is found and it stops.
When code tries to inspect the cell that contains the drop down list
the following error occurs - "1004 Application-defined or
object-defined error"
Are there other alternatives to interrogate a cell that contains a
drop down list.
Here is the code.
Public sub ProcessDropDownList()
Dim iSelectedRow As integer
Dim iSelectedCol As integer
Dim sSelected As String
Application.Goto Reference:="FirstDropDownList"
iSelectedCol = ActiveCell.Column
iSelectedRow = ActiveCell.Row
while(ActiveSheet.Cells(iSelectedRow , iSelectedCol) <> ""
'Here is the error - "1004 Application-defined or
object-defined error"
sSelected = ActiveSheet.Cells(iSelectedRow , iSelectedCol )
'
if sSelected = "YES" then Msgbox "Found: " & sSelected
iSelectedRow = iSelectedRow + 1
wend
End sub
Any help will be great
Thanks
Shakil Mian
I have a worksheet that contains a series of drop down lists (cells
B2, B3, B4... Bn). The drop down list contains YES, NO values as
options. I select YES from a list. Then code written in VBA is
executed(when i click the "Check" button) that tries to read values
from the cells that contain the values. When the code finds "YES" a
msgbox pops up with the message "Found: YES". The code does the same
for the next cell down untill a blank cell is found and it stops.
When code tries to inspect the cell that contains the drop down list
the following error occurs - "1004 Application-defined or
object-defined error"
Are there other alternatives to interrogate a cell that contains a
drop down list.
Here is the code.
Public sub ProcessDropDownList()
Dim iSelectedRow As integer
Dim iSelectedCol As integer
Dim sSelected As String
Application.Goto Reference:="FirstDropDownList"
iSelectedCol = ActiveCell.Column
iSelectedRow = ActiveCell.Row
while(ActiveSheet.Cells(iSelectedRow , iSelectedCol) <> ""
'Here is the error - "1004 Application-defined or
object-defined error"
sSelected = ActiveSheet.Cells(iSelectedRow , iSelectedCol )
'
if sSelected = "YES" then Msgbox "Found: " & sSelected
iSelectedRow = iSelectedRow + 1
wend
End sub
Any help will be great
Thanks
Shakil Mian