Creating combo box with different number of variables

G

Guest

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
 
M

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top