vba variable possible in .listfillrange? (excel 2011 ie. mac version)

jarmose

New Member
Joined
Jan 31, 2016
Messages
2
Hi,

Target: a macro should set the input range for a combobox. (Excel for Mac)

Problem:
The range can change so I cannot use a standard .listfillrange range such as “$B$1:$B$10” (which would work otherwise).
I’ve tried the following:

Sub combo()
Dim list_finalrow As Integer
list_finalrow = Sheets("sheet1").Cells(Rows.Count, "B").End(xlUp).Row
ActiveSheet.Shapes.Range(Array("Drop Down 20")).Select
With Selection
.ListFillRange = "$B$1:$B" & finalrow
.LinkedCell = "$G$5"
.DropDownLines = 8
.Display3DShading = True
End With
End Sub

The input field of the combobox stays empty.. I wonder if a variable can be used here at all?
Yours, Jarmo
 
Welcome to MrExcel.

It should be:

.ListFillRange = "$B$1:$B" & list_finalrow

You should use Option Explicit (Require variable declaration in Tools|Options|Editor tab). With that your code would have created an error.
 
Last edited:
Upvote 0

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top