Free Microsoft Excel 2013
Quick Reference
Free Microsoft 2013 Quick Reference Guide

Free Microsoft Excel 2013 Quick Reference

"Could not set the Rowsource property"

Hello again

I keep getting a "Could not set the Rowsource property. Invalid property value." error on my code.

I know I must be missing one simple little stupid thing, but for some odd reason I can't get the rowsource property of a combobox to get set right.

here is what I have:

Code:
Private Sub obEchoGlobal_Click()
   If obEchoGlobal.Value = True Then
      UserForm2.cbBOLCarrier.RowSource = "DataSheet!A64:66"
   End If
End Sub
Am I missing something there? The sheet name where the rowsource is supposed to point to is DataSheet. The combobox in the userform is called cbBOLCarrier.... and the error only comes up when I click the Option button.

Any advice would be greatly appreciated. Thanks!


Post your answer or comment

comments powered by Disqus
Hi,

I am working with excel 2010, I am using multiselect list boxes in my sheet and trying to list fill the range dynamically based on the user selection in the sheet.

The following error is frequantly appearing.

Error:

"Run-time error '440':

Could not set the ListCursor property. Unspecified error."

After this error has occurred, attempting to save it results in:

Microsoft Excel has stopped working -- Close excel (or restart if you choose to debug + stepped over the listfillrange line).

When Recovering "Excel found unreadable content in ....." - "The workbook cannot be opened or repaired by Microsoft Excel because it is corrupt".

Any possible solutions to supress these errors.

Regards,
Srinivas.

Hi there,

I am working on coding a userform. My fields are code, project name, project lead, project assist, priority, tasks, start date, duration, % complete, end date, status and comments.

I want to be able to enter multiple tasks for one project but I can not get the code right. I have five fields under tasks so that I can at least enter five at a time for one project, the field textbox is called "txtTasks" and when I enter the same name for the textbox below it I get the following message "Could not set the Name property. Ambiguous name".

Is there a way to code them so that the tasks can be entered and listed one under another?

Thank you for your time.

Hi all,

I am working on a spreadsheet with 14 columns. When i search for a value in the first column and try to populate a list box with the matching value and row. I am getting the following error

Run-Time Error '380': Could not set the list property. invalid property value.

The code i am using for populating the list box is shown.
I was able to utilize the code for a 10 column spreadsheet. I updated it for use on the 14 column spreadsheet but i am stuck. The code stops on the line with
.List(.ListCount - 1, 10) = c.Offset(0, 10).Value.

Any ideas what i am doing wrong?

Thank you for all your help

Sub Findall2()

    Dim STRFIND As String    'what to find
    Dim rFilter As Range     'range to search
    Set rFilter = Sheet2.Range("a3", Range("n65536").End(xlUp))
    Set rng = Sheet2.Range("a2", Range("a65536").End(xlUp))
    STRFIND = Me.TextBoxArrest.Value
    With Sheet2
        If Not .AutoFilterMode Then .Range("A3").AutoFilter
        rFilter.AutoFilter Field:=1, Criteria1:=STRFIND
        Set rng = rng.Cells.SpecialCells(xlCellTypeVisible)
        Me.ListBox1.Clear
        For Each c In rng
            With Me.ListBox1
                .AddItem c.Value
                .List(.ListCount - 1, 1) = c.Offset(0, 1).Value
                .List(.ListCount - 1, 2) = c.Offset(0, 2).Value
                .List(.ListCount - 1, 3) = c.Offset(0, 3).Value
                .List(.ListCount - 1, 4) = c.Offset(0, 4).Value
                .List(.ListCount - 1, 5) = c.Offset(0, 5).Value
                .List(.ListCount - 1, 6) = c.Offset(0, 6).Value
                .List(.ListCount - 1, 7) = c.Offset(0, 7).Value
                .List(.ListCount - 1, 8) = c.Offset(0, 8).Value
                .List(.ListCount - 1, 9) = c.Offset(0, 9).Value
                .List(.ListCount - 1, 10) = c.Offset(0, 10).Value
                .List(.ListCount - 1, 11) = c.Offset(0, 11).Value
                .List(.ListCount - 1, 12) = c.Offset(0, 12).Value
                .List(.ListCount - 1, 13) = c.Offset(0, 13).Value
            End With
        Next c
    End With
End Sub


Well have come across another problem when using the listbox.

I am using a userform to edit data in a database. The listbox gives me all records that have the same ID and populates the textboxes with data stored when each entry in the listbox is selected.

Have extended the size of my database and now I get the following error message

“ Runtime Error 380 – Could not set the list property. Invalid property value.”

Is there a restriction on the number of columns that can be used when doing it this way?

Private Sub UserForm1_Initialize()

ListBox1.ColumnCount = 18

End Sub

EXTRACT from macro in Userform

Loc = TextBox1.Value
ListBox1.Clear

With Worksheets("Dbase")

Set found = .Cells.Find(What:=Loc)

If Not found Is Nothing Then
Loc = found.Address
Do
ListBox1.AddItem .Cells(found.Row, 4)
ListBox1.List(ListBox1.ListCount - 1, 1) = .Cells(found.Row, 2)
ListBox1.List(ListBox1.ListCount - 1, 2) = .Cells(found.Row, 3)
ListBox1.List(ListBox1.ListCount - 1, 3) = .Cells(found.Row, 5)
ListBox1.List(ListBox1.ListCount - 1, 4) = .Cells(found.Row, 6)
ListBox1.List(ListBox1.ListCount - 1, 5) = .Cells(found.Row, 7)
ListBox1.List(ListBox1.ListCount - 1, 6) = .Cells(found.Row, 8)
ListBox1.List(ListBox1.ListCount - 1, 7) = .Cells(found.Row, 9)
ListBox1.List(ListBox1.ListCount - 1, 8) = .Cells(found.Row, 10)
ListBox1.List(ListBox1.ListCount - 1, 9) = .Cells(found.Row, 11)
ListBox1.List(ListBox1.ListCount - 1, 10) = .Cells(found.Row, 12) “Debug error message here”
ListBox1.List(ListBox1.ListCount - 1, 11) = .Cells(found.Row, 13)
ListBox1.List(ListBox1.ListCount - 1, 12) = .Cells(found.Row, 14)
ListBox1.List(ListBox1.ListCount - 1, 13) = .Cells(found.Row, 15)
ListBox1.List(ListBox1.ListCount - 1, 14) = .Cells(found.Row, 16)
ListBox1.List(ListBox1.ListCount - 1, 15) = .Cells(found.Row, 17)

Set found = .Cells.FindNext(found)

Loop While found.Address <> Loc
End If
End With

Can't understand. Look forward to hearing from you.

Cheers,
Bernz

VBA error, could not set the CurlineProperty

Apologies if this is the wrong forum, tried my best to find the most appropriate one.

Getting an error in VBA on only my machine on several sheets that work fine on other user's PCs.

The exact message is:

Run-time error '-2147418113 (8000ffff)':

Could not set the CurLine property. Unexpected call to method or property access.

The error occurs when trying to display prompts.

I can't change the sheets or the code as they are shared across many users, but can change files or upgrade any dlls on my machine.

I'm using Excel 2002 SP3 on Windows XP SP2.

Any help very appreciated.
Thanks.

Hi All,

I'm new to the board so please go easy on me

I'm creating an employee tracker for use by several users. The idea is to be able to add and remove employees to the tracker. Upon adding, the employee would have a new worksheet created, copied from a template, and they'd be added to a list (dynamic named range, and listbox) for management. Removing would delete them from the lists and delete the worksheet.

I'm running in to problems when removing.

Usually for a couple attempts the code works fine, but then I'll get errors like "Could not set the ListCursor property" or "Could not get the List Value property"

I've attached the spreadsheet below. I've been struggling with this for days. I'm using Excel 2003. Please help!

Thanks!

Greetings,

I would like to extract unique records from a dynamic named range to populate a userform combobox.

With the below code I get Run time error 380 - could not set the rowsource property. Invalid property value

When I placed the code in the immediate window, the result is "True".

Can anyone tell me what is wrong please?

Many thanks
Asha

I am very new to VBA. I am simply creating a user Form for inputting my data into the spread sheet and ensure bad data is not entered. One of the ways I do this is I have several worksheets with the information needs to populate combo boes on the form, i.e. Document Types, Client Names, etc. When I try to set the RowSource, VBA complains about "Could not set the RowSource property. Invalid property value. I am using this text for fillinn in the property: "Sheet2!A2:A10"

Can someone please give me some hints?

Thanks for reading my post.

Hello,
I have the following named range called MyRange

	VB:
	
=OFFSET(Sheet11!$A$4,0,0,COUNTA(Sheet11!$A$4:$A$500),COUNTA(Sheet11!$A$3:$F$3)) 

If you like these VB formatting tags please consider sponsoring the author in support of injured Royal Marines
I am trying to se the rowsource of my listbox to MyRange, but keep getting "Could not set the Rowsource property. Invalid Property value."
However, when I paste the actually code into the rowsource of the list box, my range of data is displayed correctly.

Am I missing a step somewhere? The reason I want to have the named range, is so that I can refer to it in the rest of my code. The named range doesn't work in my source code either.

	VB:
	
 Range("MyRange").Columns.Count - 1 

If you like these VB formatting tags please consider sponsoring the author in support of injured Royal Marines
Thanks
D0M

I have a defined range (dynamic, not that it should matter) named "Customers", within a worksheet named "set up". On userform1, I'm trying to set the RowSource of Combobox2 to "Customers" but sometimes it works, and sometimes I get the error "Could not set the RowSource Property. Invalid Property Value."

If it was never working, then I could see that. But sometimes it will work and I've found that if I go into the worksheet (which is a pain in and of itself because this is an Add-in) and goto Insert > Names and then just select that name and click ok, THEN it will work, but needless to say, the users aren't going to be able to do this, so is there another way to call a named range?

code was:
Code:
I also tried to skip the named range and just name it within the code, with this:
Code:
btm = WorksheetFunction.CountA(Sheets("set up").Range("A2:A10000"))
ComboBox2.RowSource = Worksheets("Quality_Control_TRS.xla").Sheets("set up").Range ("A2:A" & btm)
I don't know what else to try. The second try was "Script out of range". I checked the sheet name (3 times actually ) and the workbook name. I'm at the end of my knowledge (and by knowledge I mean the end of the semi-educated guesses I can make).

Any ideas?

Thanks in advance.

This one really is doing my head in !!!

I have a Userform called FormEmployeeControl which contains 2 ComboBoxes ... EmployeeNameand EmployeeAction.

I have left RowSource empty in both ComboBox definitions.

In the code, I define my dynamic Named Ranges, and this appears to work perfectly :


	VB:
	
 DefineRanges() 
     
    Sheets("Employees").Visible = True 
    Sheets("Employees").Activate 
    Names.Add "EmployeeNamesCol1", "=OFFSET($A$1,0,0,COUNTA($A:$A),1)" 
    Names.Add "EmployeeNamesCol2", "=OFFSET($B$1,0,0,COUNTA($B:$B),1)" 
    Sheets("Employees").Visible = False 
    Sheets("Misc Data").Visible = True 
    Sheets("Misc Data").Activate 
    Names.Add "EmployeeOptions", "=OFFSET($A$1,0,0,COUNTA($A:$A),1)" 
    Sheets("Misc Data").Visible = False 
    Sheets("Charge Out Rate").Visible = True 
    Sheets("Charge Out Rate").Activate 
    Names.Add "RatesCol1", "=OFFSET($A$1,0,0,COUNTA($A:$A),1)" 
    Names.Add "RatesCol2", "=OFFSET($B$1,0,0,COUNTA($B:$B),1)" 
    Sheets("Charge Out Rate").Visible = False 
     
End Sub 

If you like these VB formatting tags please consider sponsoring the author in support of injured Royal Marines
Now, when I open the Userform, I have the following :


	VB:
	
 Userform_Initialize() 
     
    EmployeeName.RowSource = "Employees!EmployeeNamesCol1" 
    EmployeeAction.RowSource = "Misc Data!EmployeeOptions" 
     
End Sub 

If you like these VB formatting tags please consider sponsoring the author in support of injured Royal Marines
The first line populates the DropDown list in the ComboBox with my list of Employees from the Dynamic named Range perfectly ...

The second line crashes, with the error message :

Run-time error '380':
Could not set the RowSource property. Invalid property value.

Am I missing what John Cleese would call "the bleeding obvious" ?!?!

I am attempting to run the following code
Code:
Private Sub btn_GetData_Click()
Dim maintLog, existCust As Worksheet
Set maintLog = Sheets("Maintenance Log")
Set existCust = Sheets("Existing Customers")
existCust.Range("L1").Value = cbo_SearchAmend
existCust.Range("L2").Value = txt_TextToSearchFor
existCust.Range("A1").CurrentRegion.AdvancedFilter Action:=xlFilterCopy, _
    criteriarange:=existCust.Range("L1:L2"), copytorange:=existCust.Range("N1:W1")
lst_SearchExistingResults.RowSource = "Existing Customers!" & existCust.Range("outdata").Address
End Sub
It seems to run successfully until it reaches "lst_SearchExistingResults..." at which point it returns the error 380: Could not set the rowsource property. Invalid Property Value.

I haven't got a huge amount of hair but what I do have I am pulling out!! Any help would be greatly appreciated

Is it possible to have the rowsource in a listbox set to the following range
("rng") that I have defined in a vb module? I keep getting the following
message: "Could not set the RowSource property. Invalid property value." Do
I need to insert the code somewhere else? Thank you!
----
Dim rng As Range
lastrow = Cells(1, 1).End(xlDown).Row
rng = Sheet1.Range(Cells(1, 1), Cells(lastrow, 2))
----------

The following line:
CboCase.RowSource = "'[Computer Price calculator.xls]Case'!$A$2:$B$4"
gives an error message: "runtime error 380.Could not set the Rowsource
property. Invalid property value"

The problem does not appear if I remove the spaces from the file name and
the single quotes but it appears if I remove the spaces and leave the single
quotes in place. Does anyone know how to make it work without having to
remove the spaces from the filename?

Thanks in advance
--
Marinos Andreou
B.Sc Computer Engineering
mobile: 99-533228

I originally posted this question on 11/14, but I still haven't been able to
figure out how to solve the problem based on the response that I got. So I
am posting the question again in more detail.

If Noah is the user, I want the RowSource of ListBox1 in UserForm1 to fill
with values from Sheet1. If Joe is the user, I want the RowSource of
ListBox1 in UserForm1 to fill with values from Sheet2. I am not sure if this
is the right think to do, but I have left the RowSource field in the
Properties of ListBox1 empty.
-----------------------
I currently have the following code in Module1:
Public rng as Range

Sub Macro1()
Dim User As String
User = Environ("UserName")
Select Case User
Case "Noah"
lastrow = Sheet1.Cells(1, 1).End(xlDown).Row
rng = Sheet1.Range(Cells(1, 1), Cells(lastrow, 2))
UserForm1.Show
Case “Joe”
lastrow = Sheet2.Cells(1, 1).End(xlDown).Row
rng = Sheet2.Range(Cells(1, 1), Cells(lastrow, 2))
UserForm1.Show
Case Else
End Select
End Sub
-----------------------
I currently have the following code in the code module for UserForm1:

Private Sub UserForm_Initialize()
Me.ListBox1.RowSource = rng.Address
End Sub
------------------------

The error message that I keep getting is: "Could not set the RowSource
property. Invalid property value." Please help! Thanks!

I have a combobox on a userform, that I want to have the cbo pick up a list off of one of the worksheets instead of .add item for 300 items.

I went to the RowSource property for the combobox and put

=Sheet2!A100:A400

And it gave me an error that said

could not set the RowSource property. Invalid property value.

Could someone please help or clarify where I am stuck at.

Thanks

Josh

Hi guys,
i am doing modification to an excel macro. however i got 1 problem, whenever i try to open the exel macro when an excel spreadsheet is already opened, i got an error:
Run-time error:'380'
Could not set the RowSource property. Invalid property value.

In my excel macro, i got an object called 'ThisWorkbook' which loads whenever the excel macro loads. It contains the following code:

Private Sub Workbook_Open()
Load InputFrm
InputFrm.Show
End Sub

I am thinking maybe the reason that i cannot open the excel macro when an excel spreadsheet is opened is because the excel macro executes the codes inside the same excel window where the excel spreadsheet is opened. Thus resulting in it cannot find the 'ThisWorkbook' in the 1st excel spreadsheet.

Can someone help me in this problem? i have been looking through the error code in the website but cannot find any clue.

If that cannot be done, is it possible to set excel to open in a new excel window when i double click the excel file? because if i open it in a different excel window, there's no problem. only not dynamic. I am sure there's way to do better.

Please help me guys, thanks!

If I select the 1st choice from cboCounty ("Dallas") it works fine.
When I select any other choice from the list, I get the following error:
"Run-time error '380': Could not set the RowSource property. Invalid property value."

Userform contains : cboCounty (combobox)
cboZip (combobox)
lblCity (label)

When a user selects cboCounty, it populates cboZip.
When a user then selects cboZip, I need it to populate the corresponding city name into the lblCity

The lists are stored in a sheet called "Data" (see example workbook attached)

Private Sub UserForm_Initialize()

	cboCounty.RowSource = "County"
	cboZip.RowSource = vbNullString

End Sub


Private Sub cboCounty_Change()
Dim strRange As String
    If cboCounty.ListIndex > -1 Then
       strRange = cboCounty
       strRange = Replace(strRange, " ", "_")
                 With cboLocation
                .RowSource = vbNullString
                .RowSource = strRange
                .ListIndex = 0
            End With
    
    Else
     Exit Sub
End If
End Sub



Private Sub cboZip_Change()
    Select Case cboZip.ListIndex
    Case Is > -1
       lblCity.Caption = ActiveWorkbook.Sheets("Data").Cells(cboZip.ListIndex + 1, 3).Value
    Case Else
    Exit Sub
        End Select
    
End Sub
Col A = named range "County"
Col B = named range "Dallas"
Col C = corresponding city name to Col B
Col D = named range "Conroe"
Col E = corresponding city name to Col D
Col F = named range "Williams"
Col G = corresponding city name to Col F

NOTE: this is not my real data and the lists are very long. So, I cannot use .AddItem or any other manual form of coding the data into the code.

Hi guys,
i am doing modification to an excel macro. however i got 1 problem, whenever i try to open the exel macro when an excel spreadsheet is already opened, i got an error:
Run-time error:'380'
Could not set the RowSource property. Invalid property value.

In my excel macro, i got an object called 'ThisWorkbook' which loads whenever the excel macro loads. It contains the following code:

Private Sub Workbook_Open()
Load InputFrm
InputFrm.Show
End Sub

I am thinking maybe the reason that i cannot open the excel macro when an excel spreadsheet is opened is because the excel macro executes the codes inside the same excel window where the excel spreadsheet is opened. Thus resulting in it cannot find the 'ThisWorkbook' in the 1st excel spreadsheet.

Can someone help me in this problem? i have been looking through the error code in the website but cannot find any clue.

If that cannot be done, is it possible to set excel to open in a new excel window when i double click the excel file? because if i open it in a different excel window, there's no problem. only not dynamic. I am sure there's way to do better.

Please help me guys, thanks!

Hi all,

I hope this is the correct place to post this.

I am having major issues with such a stupid issue.

I have set up a combo box in a userform which draws information from a worksheet called TEST. I set this up in the properties of the combo box. So I use this:
Ok the problem is I don't want the worksheet to be called test I want it to have a meaningful name like.  'Controls for
Staff'.  I cannot change the name of the worksheet to anything above 6 characters without getting an error when I enter it in
the combo box source.

The error is:
Could not set the RowSource property. Invalid property value.

Anyone got any ideas?

Cheers

Simon

When I run the macro I get "Unable to set the XValues property of Series class" error.


	VB:
	
 temp() 
    ActiveChart.SeriesCollection(1).XValues = Range("F7:F12") 
    ActiveChart.SeriesCollection(2).XValues = Range("F7:F12") 
End Sub 

If you like these VB formatting tags please consider sponsoring the author in support of injured Royal Marines
The error is generated when executing the second line. I believe that this issue occurs because the macro is not able to access the second series as it contains all #N/A's. Whether or not the series contains errors, VBA should be allowed to change the chart's source data.

I have attached the workbook where we can replicate the error. Please could someone see whether its an issue with Excel?

Hi,

I am trying to hide a column if I find a specific string in the range. This code worked before I made some minor but necessary changes. Now, not all columns with the search string are hidden. I can't even set the colwidth property. I am stuck because there is very little on this type of error. Below is my code:

Dim rngdata2 as range
For Each rngData2 In Range("A6:CW6")
If (InStr(rngData2.Value, "DIFF") 0) Or (InStr(rngData2.Value, "SPEC") 0) Or (InStr(rngData2.Value, "NOTES") 0) Then
rngData2.EntireColumn.Hidden = True
Else
rngData2.EntireColumn.Hidden = False
End If
Next rngData2

I would really appreciate if someone could please help!

Happy New Year to you all!

I get Runtime error '1004': "Unable to set the PrintArea property of the
PageSetup class" at the line below starting with "Sheet1.PageSetup.PrintArea
=" as noted by "error" below.

Do any of you see any obvious error I done with the code? Could it be caused
by not having the right window active?
Here is the extract from the code:
....
With Application.CommandBars.FindControl(id:=182)
If .State = msoButtonDown Then .Execute
End With
Application.ThisWorkbook.Windows(ThisWorkbook.Name).View =
xlPageBreakPreview '
Sheet1.PageSetup.PrintArea =
Sheet1.Range("A1:O1450").SpecialCells(xlCellTypeVisible).Address '
< ---_H_E_R_E_
....

The code is initated by a button event in an UserForm procedure 'Sub
CommandButton1_Click' and after several code procedures this happen in the
end. All I want is to hide rows and show others in sheet1(codename).

At first I thougt it was caused by to many signs (>256), but it was just
this address: $A$1:$O$369,$A$514:$O$801,$A$946:$O$1231,$A$1375:$O$1450
Any comments?

/Regards

I am trying to set the background color of cells based on their content for scheduling purposes (for example, if a coworker is taking calls the cell's content is "C" and the background is white; if the coworker is at lunch the content is "L" and the background is green). The code I've written for this is as follows:


	VB:
	
 Excel.Range) 
     
    Application.EnableEvents = False 
     
    Dim Color As Long 
     
    For Each TargetCell In Target.Cells 
         
         ' find the default color for the cell
        Color = Worksheets("Data").Range("A2").Interior.ColorIndex 
         
         ' check each cell in the Data!A3:A20 range for the correct schedule code
        For Each DataCell In Worksheets("Data").Range("A3:A20") 
            If DataCell.Value = TargetCell.Value Then 
                 ' when we find the right schedule code, grab the background color
                Color = DataCell.Interior.ColorIndex 
                Exit For 
            End If 
        Next DataCell 
         ' after we have found the right color for the cell, set the color
        TargetCell.Interior.ColorIndex = Color ' this is the line that errors
    Next TargetCell 
     
    Application.EnableEvents = True 
     
End Sub 

If you like these VB formatting tags please consider sponsoring the author in support of injured Royal Marines
Data!A2 is formatted with the default color, and Data!A3:A20 has cells with the scheduling code and that are formatted as I need them to be. The code checks the changed cell against the list A3:A20 and once it finds the correct code it copies that ColorIndex to the TargetCell's ColorIndex. This works like a champ when I make changes to cells manually. If I change the cell from "C" to "L" it automatically changes the background to green like it should. The problem arises because I have a drop down list that I use for quickly shifting a person's schedule from the early shift to the late shift or vice versa. Whenever I use this list to change the schedule, I get an error that pops up and says "Run-time error '1004': Unable to set the ColorIndex property of the Interior class." The code that triggers the cell's contents to change is as follows:


	VB:
	
CellRange = "C" & i 
Range(CellRange).FormulaR1C1 = "C" 

If you like these VB formatting tags please consider sponsoring the author in support of injured Royal Marines
where i is an integer counter. Setting it to C is just one example, it does not matter what string I set the cell's formula to. I found another thread where the sheet being protected was the problem and gave the same error when trying to set the Interior.ColorIndex property, but nothing in my worksheet is protected. Again, selecting the cell and typing in a value works properly, but using VBA code to set the contents of the cell causes the run-time error. Does anyone have any ideas what might cause this to happen?


No luck finding an answer? You could always try Google.