Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default ComboBox Values

I'm truing to change the values in a drop-down list box selector, but the following generates a Runtime Error 424 on the ComboBox line(s).

Is is possible to do what I want? What is the correct syntax, please?
__________________________________________________ ____________________
If Cells(5, 111).Value = "" Then
p = Cells(2, 114).Value
With WorkingSheet
ComboBox3.ControlFormat.ListFillRange = Range(Cells(5, 112), Cells(p, 112))
End With
GoTo Equipment
Else
p = Cells(2, 118).Value
With WorkingSheet
ComboBox3.ControlFormat.ListFillRange = Range(Cells(5, 112), Cells(p, 112))
End With
End If
_____________________________________

Thanks,
Jim Berglund
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default ComboBox Values

is workingsheet a variable holding a reference to a worksheet?

for example

Dim workingSheet as Worksheet
set workingsheet = Worksheets("Sheet1")

if so you can do

workingSheet.OleObjects("Combobox3").ListfillRange = _
Range(Cells(5, 112), Cells(p, 112))

I would prefer to see a qualification for the sheet holding the range as
well unless that sheet is the activesheet

set sh = Worksheets("Data")

workingSheet.OleObjects("Combobox3").ListfillRange = _
sh.Range(sh.Cells(5, 112), sh.Cells(p, 112))

--
Regards,
Tom Ogilvy

"Jim Berglund" <berglunj@ric
her.ca wrote in message news:yXrUc.131425$J06.21341@pd7tw2no...
I'm truing to change the values in a drop-down list box selector, but the
following generates a Runtime Error 424 on the ComboBox line(s).

Is is possible to do what I want? What is the correct syntax, please?
__________________________________________________ ____________________
If Cells(5, 111).Value = "" Then
p = Cells(2, 114).Value
With WorkingSheet
ComboBox3.ControlFormat.ListFillRange = Range(Cells(5, 112),
Cells(p, 112))
End With
GoTo Equipment
Else
p = Cells(2, 118).Value
With WorkingSheet
ComboBox3.ControlFormat.ListFillRange = Range(Cells(5, 112),
Cells(p, 112))
End With
End If
_____________________________________

Thanks,
Jim Berglund


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default ComboBox Values

I am entering this subroutine from another sub, where the WorkingSheet has
been defined
i.e
Private Sub CommandButton4_Click() 'Load Files
...
[Module1].CreateLists "Analyzer"
....
End sub
_________________________________
Sub CreateLists(workingSheet)

Dim i, j, k, p, numberofRows As Integer
....
(the aforementioned code)
....
End Sub

I tried your suggestion - both ways, but ran into additonal errors.

"Tom Ogilvy" wrote in message
...
is workingsheet a variable holding a reference to a set workingsheet =

Worksheets("Sheet1")

if so you can do

workingSheet.OleObjects("Combobox3").ListfillRange = _
Range(Cells(5, 112), Cells(p, 112))

I would prefer to see a qualification for the sheet holding the range as
well unless that sheet is the activesheet

set sh = Worksheets("Data")

workingSheet.OleObjects("Combobox3").ListfillRange = _
sh.Range(sh.Cells(5, 112), sh.Cells(p, 112))

--
Regards,
Tom Ogilvy

"Jim Berglund" <berglunj@ric
her.ca wrote in message news:yXrUc.131425$J06.21341@pd7tw2no...
I'm truing to change the values in a drop-down list box selector, but the
following generates a Runtime Error 424 on the ComboBox line(s).

Is is possible to do what I want? What is the correct syntax, please?
__________________________________________________ ____________________
If Cells(5, 111).Value = "" Then
p = Cells(2, 114).Value
With WorkingSheet
ComboBox3.ControlFormat.ListFillRange = Range(Cells(5, 112),
Cells(p, 112))
End With
GoTo Equipment
Else
p = Cells(2, 118).Value
With WorkingSheet
ComboBox3.ControlFormat.ListFillRange = Range(Cells(5, 112),
Cells(p, 112))
End With
End If
_____________________________________

Thanks,
Jim Berglund




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default ComboBox Values

Private Sub CommandButton4_Click() 'Load Files
...
[Module1].CreateLists Worksheets("Analyzer")
....
End sub
_________________________________
Sub CreateLists(workingSheet as Worksheet)

Dim i, j, k, p, numberofRows As Integer
....

....
End Sub

as declared i, j, k, p are variants, not integers, not that it probably
makes any difference.

--
Regards,
Tom Ogilvy


"Jim Berglund" wrote in message
news:Y5tUc.134401$gE.417@pd7tw3no...
I am entering this subroutine from another sub, where the WorkingSheet

has
been defined
i.e
Private Sub CommandButton4_Click() 'Load Files
...
[Module1].CreateLists "Analyzer"
...
End sub
_________________________________
Sub CreateLists(workingSheet)

Dim i, j, k, p, numberofRows As Integer
...
(the aforementioned code)
...
End Sub

I tried your suggestion - both ways, but ran into additonal errors.

"Tom Ogilvy" wrote in message
...
is workingsheet a variable holding a reference to a set workingsheet =

Worksheets("Sheet1")

if so you can do

workingSheet.OleObjects("Combobox3").ListfillRange = _
Range(Cells(5, 112), Cells(p, 112))

I would prefer to see a qualification for the sheet holding the range as
well unless that sheet is the activesheet

set sh = Worksheets("Data")

workingSheet.OleObjects("Combobox3").ListfillRange = _
sh.Range(sh.Cells(5, 112), sh.Cells(p, 112))

--
Regards,
Tom Ogilvy

"Jim Berglund" <berglunj@ric
her.ca wrote in message news:yXrUc.131425$J06.21341@pd7tw2no...
I'm truing to change the values in a drop-down list box selector, but

the
following generates a Runtime Error 424 on the ComboBox line(s).

Is is possible to do what I want? What is the correct syntax, please?
__________________________________________________ ____________________
If Cells(5, 111).Value = "" Then
p = Cells(2, 114).Value
With WorkingSheet
ComboBox3.ControlFormat.ListFillRange = Range(Cells(5, 112),
Cells(p, 112))
End With
GoTo Equipment
Else
p = Cells(2, 118).Value
With WorkingSheet
ComboBox3.ControlFormat.ListFillRange = Range(Cells(5, 112),
Cells(p, 112))
End With
End If
_____________________________________

Thanks,
Jim Berglund






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default ComboBox Values

Tom, I have called a subroutine from a subroutine as follows:

Private Sub CommandButton4_Click() 'Load Files
Dim i, j, k, x, y, numberofRows As Integer, numberofColumns, nextCol As
Integer
Dim workingSheet As Worksheet

...
[Module1].CreateLists "Analyzer"
End Sub
__________________________________________________ _____

Sub CreateLists(workingSheet)

Dim i, j, k, p, numberofRows As Integer

Set ws = Worksheets("Analyzer")
Application.ScreenUpdating = False

ws.Activate

ActiveSheet.Range("CX13:DD23").Select
Selection.ClearContents
ActiveSheet.Range("DG5").Select
If Cells(5, 111).Value = "" Then
p = Cells(2, 114).Value 'Number of non-blank cells in the EqptType
Column
workingSheet.OLEObjects("Combobox3").ListFillRange = _
ws.Range(ws.Cells(5, 112), ws.Cells(p, 112))
GoTo Equipment
Else
p = Cells(2, 118).Value 'Number of non-blank cells in the
EqptType2 Column
workingSheet.OLEObjects("Combobox3").ListFillRange = _
ws.Range(ws.Cells(5, 116), ws.Cells(p, 116))
End If
...
End sub

Now I'm running into a 424 "Object Required" error.

Have I interpreted your suggestions correctly? Do you have additional
advice, please?

"Tom Ogilvy" wrote in message
...
is workingsheet a variable holding a reference to a worksheet?

for example

Dim workingSheet as Worksheet
set workingsheet = Worksheets("Sheet1")

if so you can do

workingSheet.OleObjects("Combobox3").ListfillRange = _
Range(Cells(5, 112), Cells(p, 112))

I would prefer to see a qualification for the sheet holding the range as
well unless that sheet is the activesheet

set sh = Worksheets("Data")

workingSheet.OleObjects("Combobox3").ListfillRange = _
sh.Range(sh.Cells(5, 112), sh.Cells(p, 112))

--
Regards,
Tom Ogilvy

"Jim Berglund" <berglunj@ric
her.ca wrote in message news:yXrUc.131425$J06.21341@pd7tw2no...
I'm truing to change the values in a drop-down list box selector, but the
following generates a Runtime Error 424 on the ComboBox line(s).

Is is possible to do what I want? What is the correct syntax, please?
__________________________________________________ ____________________
If Cells(5, 111).Value = "" Then
p = Cells(2, 114).Value
With WorkingSheet
ComboBox3.ControlFormat.ListFillRange = Range(Cells(5, 112),
Cells(p, 112))
End With
GoTo Equipment
Else
p = Cells(2, 118).Value
With WorkingSheet
ComboBox3.ControlFormat.ListFillRange = Range(Cells(5, 112),
Cells(p, 112))
End With
End If
_____________________________________

Thanks,
Jim Berglund






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
using VBA to retrieve values to ComboBox Serene Excel Discussion (Misc queries) 0 March 19th 10 02:21 AM
Values of ComboBox fields and SQL Ant(antonfh_at_gmail_dot_com) Excel Discussion (Misc queries) 3 May 23rd 06 02:03 PM
Entering Values into Combobox in Spreadsheet Regnab Excel Discussion (Misc queries) 2 May 4th 06 12:57 PM
Displaying Unique Values in a Combobox Todd Htuttenstine Excel Programming 2 January 20th 04 09:33 PM
ComboBox Values Darren[_3_] Excel Programming 1 July 16th 03 10:41 AM


All times are GMT +1. The time now is 12:37 PM.

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"