Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 270
Default Why Am I Getting This Error Message Please?

I can't figure out why I'm getting an "invalid qualifier" error message on
this; each time it points to the word 'Selected' in the code. Any help would
be appreciated. (All I want the code to do is: If an item is selected in
Option2ListBox, then I want to delete any row in the Schedules tab that has
that item in Col H.)

Private Sub OKButton_Click()
Dim x As Integer
Dim Lrow As Long

'Loop through the items in the ListBox control.
For x = 0 To Option2ListBox.ListCount - 1

' If the item is selected, then deletes any row in the 'Schedules' tab that
has that value in it
If Option2ListBox.Selected(x) = True Then
If worksheets("Schedules").cells(Lrow, "H").Value =
ImportingSchedules.Option2ListBox.Selected(x).Valu e Then
worksheets("Schedules").Rows(Lrow).Delete
End If
End If

Next x

Unload ImportingSchedules
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 149
Default Why Am I Getting This Error Message Please?

I'm thinking
...ImportingSchedules.Option2ListBox.Selected(x).V alue...

should use something other than Selected. maybe:
.....ImportingSchedules.Option2ListBox.List(x,0).. .

HTH,

"Paige" wrote in message
...
I can't figure out why I'm getting an "invalid qualifier" error message on
this; each time it points to the word 'Selected' in the code. Any help
would
be appreciated. (All I want the code to do is: If an item is selected in
Option2ListBox, then I want to delete any row in the Schedules tab that
has
that item in Col H.)

Private Sub OKButton_Click()
Dim x As Integer
Dim Lrow As Long

'Loop through the items in the ListBox control.
For x = 0 To Option2ListBox.ListCount - 1

' If the item is selected, then deletes any row in the 'Schedules' tab
that
has that value in it
If Option2ListBox.Selected(x) = True Then
If worksheets("Schedules").cells(Lrow, "H").Value =
ImportingSchedules.Option2ListBox.Selected(x).Valu e Then
worksheets("Schedules").Rows(Lrow).Delete
End If
End If

Next x

Unload ImportingSchedules
End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Why Am I Getting This Error Message Please?

On Aug 22, 4:56 pm, "George Nicholson"
wrote:
I'm thinking ...ImportingSchedules.Option2ListBox.Selected(x).V alue...

should use something other than Selected. maybe:
....ImportingSchedules.Option2ListBox.List(x,0)...

HTH,

"Paige" wrote in message

...



I can't figure out why I'm getting an "invalid qualifier" error message on
this; each time it points to the word 'Selected' in the code. Any help
would
be appreciated. (All I want the code to do is: If an item is selected in
Option2ListBox, then I want to delete any row in the Schedules tab that
has
that item in Col H.)


Private Sub OKButton_Click()
Dim x As Integer
Dim Lrow As Long


'Loop through the items in the ListBox control.
For x = 0 To Option2ListBox.ListCount - 1


' If the item is selected, then deletes any row in the 'Schedules' tab
that
has that value in it
If Option2ListBox.Selected(x) = True Then
If worksheets("Schedules").cells(Lrow, "H").Value =
ImportingSchedules.Option2ListBox.Selected(x).Valu e Then
worksheets("Schedules").Rows(Lrow).Delete
End If
End If


Next x


Unload ImportingSchedules
End Sub- Hide quoted text -


- Show quoted text -


You need to tell the macro to select the option2ListBox and then check
the value of the selection
I'm not sure what the selection is when the button is clicked, but you
should put that into memory before you select the list box to check
the value so you can re-select what was originally selected.

For example If a range was selected:
Dim ac as range, sel as selection
Set ac = activecell
Set sel = selection

activesheet.shapes("option2ListBox").select
If selection.value = true then
'Insert Code here
end If

sel.select
ac.activate

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 270
Default Why Am I Getting This Error Message Please?

Thanks, guys! Will try these. Don, now that you explain it that way....it
makes more sense. Will work on this and post back the results (for future
reference by others). Appreciate it!!!

"Don" wrote:

On Aug 22, 4:56 pm, "George Nicholson"
wrote:
I'm thinking ...ImportingSchedules.Option2ListBox.Selected(x).V alue...

should use something other than Selected. maybe:
....ImportingSchedules.Option2ListBox.List(x,0)...

HTH,

"Paige" wrote in message

...



I can't figure out why I'm getting an "invalid qualifier" error message on
this; each time it points to the word 'Selected' in the code. Any help
would
be appreciated. (All I want the code to do is: If an item is selected in
Option2ListBox, then I want to delete any row in the Schedules tab that
has
that item in Col H.)


Private Sub OKButton_Click()
Dim x As Integer
Dim Lrow As Long


'Loop through the items in the ListBox control.
For x = 0 To Option2ListBox.ListCount - 1


' If the item is selected, then deletes any row in the 'Schedules' tab
that
has that value in it
If Option2ListBox.Selected(x) = True Then
If worksheets("Schedules").cells(Lrow, "H").Value =
ImportingSchedules.Option2ListBox.Selected(x).Valu e Then
worksheets("Schedules").Rows(Lrow).Delete
End If
End If


Next x


Unload ImportingSchedules
End Sub- Hide quoted text -


- Show quoted text -


You need to tell the macro to select the option2ListBox and then check
the value of the selection
I'm not sure what the selection is when the button is clicked, but you
should put that into memory before you select the list box to check
the value so you can re-select what was originally selected.

For example If a range was selected:
Dim ac as range, sel as selection
Set ac = activecell
Set sel = selection

activesheet.shapes("option2ListBox").select
If selection.value = true then
'Insert Code here
end If

sel.select
ac.activate


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
replace VBA run-time error message with custom message BEEJAY Excel Programming 13 July 14th 06 03:59 PM
error message: compile error, argument not optional Pierre via OfficeKB.com Excel Programming 3 September 5th 05 03:45 PM
Excel XP error message Run Time Error 91 Lenny[_3_] Excel Programming 1 March 3rd 05 10:15 PM
changing the message in an error message The Villages DA Excel Worksheet Functions 2 February 18th 05 05:30 PM
How do I get rid of "Compile error in hidden module" error message David Excel Discussion (Misc queries) 4 January 21st 05 11:39 PM


All times are GMT +1. The time now is 07:14 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"