ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Creating combo box with different number of variables (https://www.excelbanter.com/excel-worksheet-functions/33666-creating-combo-box-different-number-variables.html)

fullers

Creating combo box with different number of variables
 
I currently have this macro set up to create a combo box. What I would like
to do is change the .ListFillRange so that if I add more rows of data it will
pick these up automatically. The data always starts in "A1".

Thanks

Sub Macro1()

ActiveSheet.DropDowns.Add(250.5, 451.5, 110.25, 25.5).Select
With Selection
.ListFillRange = "$A$1:$A$50"
.LinkedCell = "$G$37"
.DropDownLines = 8
.Display3DShading = False
End With
Range("A36").Select
End Sub

moi

Dim wb As Workbook
Dim ws As Worksheet
Set wb = ThisWorkbook
Set ws = wb.ActiveSheet
ws.Cells(65536, 1).Select
Selection.End(xlUp).Select
Dim lfRange As String
lfRange = "$A$1:$A$" & ActiveCell.Row
ActiveSheet.DropDowns.Add(250.5, 451.5, 110.25, 25.5).Select
With Selection
.ListFillRange = lfRange
.LinkedCell = "$G$37"
.DropDownLines = 8
.Display3DShading = False
End With
Range("A36").Select
End Sub


"fullers" schreef in bericht
...
I currently have this macro set up to create a combo box. What I would like
to do is change the .ListFillRange so that if I add more rows of data it
will
pick these up automatically. The data always starts in "A1".

Thanks

Sub Macro1()

ActiveSheet.DropDowns.Add(250.5, 451.5, 110.25, 25.5).Select
With Selection
.ListFillRange = "$A$1:$A$50"
.LinkedCell = "$G$37"
.DropDownLines = 8
.Display3DShading = False
End With
Range("A36").Select
End Sub





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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com