LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 270
Default Setting Listbox Size VBA

Hi

I think I have cracked the first bit

Sub TestListBox()

Range("G2:G31").Select
Selection.Copy
Range("I2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False

Dim x As Integer
x = Sheets("Validation Lists").Range("K1").Value

ThisWorkbook.Names.Add Name:="ListBoxCourse", _
RefersTo:=Range(Cells(2, 9), Cells(x + 1, 9)), Visible:=True

Range("H1").Select

End Sub

Not got a clue about A-Z ing the list box but this seems to do the basic
job.

Sandy

"Sandy" wrote in message
...
I have a list of data (non-numeric) in column I (with a heading). This list
varies in the number of entries there are.

If I use COUNTA to establish the number of non-blank cells I always get an
error; eg I have 6 entries at the moment which is correctly given by the
formula in K1:- "=(ROWS(I2:I50)-COUNTBLANK(I2:I50)) whereas COUNTA arrives
at afigure of 28????

Anyway, if I use the list as is, my listbox contains 22 blank entries. I
would like to use the result from K1 to set the named range "ListBox" to
I2:I7, in other words the 6 non-blank entries. The non-blank cells always
appear at the top of the column as a result of manipulation, prior to
pasting to column I.

An added bonus would be to set them A-Z too, :-)

Any help greatly appreciated

Sandy



 
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
Setting and filter Listbox data Gizmo63 Excel Discussion (Misc queries) 1 February 5th 07 04:03 PM
Setting cell size to scale D Brooks Excel Discussion (Misc queries) 1 August 1st 06 07:31 PM
Setting up a validation of data listbox to provide the unique items within a range [email protected] Excel Worksheet Functions 8 July 30th 06 09:00 AM
Determine size of listbox Jasper Excel Discussion (Misc queries) 3 April 18th 06 10:38 PM
custom paper size setting Boyd New Users to Excel 4 August 26th 05 06:14 AM


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

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"