Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Input box range - output range
Sub UniqueFindColumn()
Dim AnArray() As String, i As Long Dim Selec As Range Dim Desti As Range Set Selec = Application.InputBox( _ Prompt:="Select cell for Actual data.", Type:=8) Set Desti = Application.InputBox( _ Prompt:="Select cell for Actual data.", Type:=8) AnArray = GetUniqueEntries(Selec) If Len(AnArray(0)) 0 Then For i = 0 To UBound(AnArray) Range(Desti).Offset(i, 0) = AnArray(i) Next End If End Sub What wrong in the above macro with respect to my output i.e Desti range. Thxs Actual I tried to amend the macro below: Sub UniqueFind() Dim AnArray() As String, i As Long AnArray = GetUniqueEntries(Range("A1:D12")) If Len(AnArray(0)) 0 Then For i = 0 To UBound(AnArray) Range("F1").Offset(i, 0) = AnArray(i) Next End If End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Input box range - output range
Hello al007, The range object variables must be set to an existing reference. I made the changes to your code for you. The InputBox is merely supplying a string address that describes the range and is not itself a range. You can not reference cells that are not on the active sheet with this Sub. Sub UniqueFindColumn() Dim AnArray() As String, i As Long Dim Selec As Range Dim Desti As Range Dim Rng Rng = Application.InputBox( _ Prompt:="Select cell for Actual data.", Type:=8) Set Selec = Range(Rng) Rng = Application.InputBox( _ Prompt:="Select cell for Actual data.", Type:=8) Set Desti = Range(Rng) AnArray = GetUniqueEntries(Selec) If Len(AnArray(0)) 0 Then For i = 0 To UBound(AnArray) Range(Desti).Offset(i, 0) = AnArray(i) Next End If End Sub -- Leith Ross ------------------------------------------------------------------------ Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465 View this thread: http://www.excelforum.com/showthread...hreadid=486773 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Input box range - output range
Ross,
The code is stopping at Set Selec = Range(Rng) PLs help |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Input box range - output range
Hello al007, What did you type into the input box? Thanks, Leith Ross -- Leith Ross ------------------------------------------------------------------------ Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465 View this thread: http://www.excelforum.com/showthread...hreadid=486773 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Input box range - output range
My selected range e.g A1:D12
My desti range e.g F1 Guess code need to amended thxs |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Input box range - output range
Desti is already a range.
I think you want: Desti.Offset(i, 0) = AnArray(i) instead of: Range(Desti).Offset(i, 0) = AnArray(i) al007 wrote: Sub UniqueFindColumn() Dim AnArray() As String, i As Long Dim Selec As Range Dim Desti As Range Set Selec = Application.InputBox( _ Prompt:="Select cell for Actual data.", Type:=8) Set Desti = Application.InputBox( _ Prompt:="Select cell for Actual data.", Type:=8) AnArray = GetUniqueEntries(Selec) If Len(AnArray(0)) 0 Then For i = 0 To UBound(AnArray) Range(Desti).Offset(i, 0) = AnArray(i) Next End If End Sub What wrong in the above macro with respect to my output i.e Desti range. Thxs Actual I tried to amend the macro below: Sub UniqueFind() Dim AnArray() As String, i As Long AnArray = GetUniqueEntries(Range("A1:D12")) If Len(AnArray(0)) 0 Then For i = 0 To UBound(AnArray) Range("F1").Offset(i, 0) = AnArray(i) Next End If End Sub -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Forumla that Looks up a range of output from one cell | Excel Worksheet Functions | |||
List Box - For Input Range can I use named range in another workbo | Excel Worksheet Functions | |||
Print output does not contain entire range | Excel Discussion (Misc queries) | |||
CODE to select range based on User Input or Value of Input Field | Excel Programming | |||
Macro to input formula in range based on another range | Excel Programming |