LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 852
Default Read a range into an array

I found this code that makes a DV drop down.
The example to populate the array was like this, which produced a DV with selections of 1, 2, 3, 4, 5.

Dim ValidationList(5) As Variant

Using the example from a Chip P's site (commented out in the code) I want the list in column F to be the DV source list.

The only difference I see is the array name and the range to read into it. But it throws a subscript out of range error.

Thanks,
Howard

Sub DV_Test()
Dim ValidationList() As Variant, i As Integer
ValidationList = Range("F1:F10")

' Dim Arr() As Variant
' Arr = Range("A1:A10")

For i = 0 To UBound(ValidationList)
ValidationList(i) = i + 1
Next

With Range("A1").Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, _
Operator:=xlEqual, Formula1:=Join(ValidationList, ",")
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
End Sub
 
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
Read a Range into an Array Paul Black Excel Programming 4 August 12th 07 07:47 PM
Read range to array Arne Hegefors Excel Programming 2 June 12th 07 03:32 PM
How do i read Selection.Shapes.Range(Array(i)? Harry Excel Programming 2 September 6th 05 03:46 PM
Read a range to an array Microsoft Forum Excel Programming 4 January 23rd 05 05:23 PM
Read Range Data into Array Stratuser Excel Programming 1 April 26th 04 06:46 PM


All times are GMT +1. The time now is 09:44 PM.

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"