Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 477
Default Have this great Macro, but!!

It's returning a r/t 1004 - The extracted range has a missing or illegal
field name
message << maybe just under certaini conditions,, my current problem (when
I'm getting the error message occurs when --
My Seleted range includes 25 numbers formatted as test (sorted ascending with
duplicated numbers)

Can someone spot my problem?
TIA,

Sub DumpUnique()
Dim rng As Range
If Selection.Columns.Count 1 Then
MsgBox "You can only select One Column of Cells, Try again."
Exit Sub
End If
If Selection.Row = 1 Then
MsgBox "Your Selection cannot include Row 1, Try again."
Exit Sub
End If
TLocation = InputBox("To What Cell do I drop the Unique data")
Set rng = Selection.Offset(-1, 0) _
.Resize(Selection.Rows.Count + 1, 1)
rng(1).Value = "TempHeader"
rng.AdvancedFilter Action:=xlFilterCopy, _ ' Is bombing here !!!
CopyToRange:=Range(TLocation), Unique:=True
rng(1).Value = ""
Range(TLocation).CurrentRegion.Sort Key1:=Range(TLocation), _
Order1:=xlAscending, Header:=xlYes
Range(TLocation).Delete shift:=xlUp
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default Have this great Macro, but!!

Error is when you try to use Advanced Filter, and error message indicates
"missing or illegal field name." Advanced filter requires a distinguishable
column header and my guess is that your range does not have one. Your list
should follow these requirements (from Help file):

List format
Use formatted column labels Create column labels in the first row of the
list. Excel uses the labels to create reports and to find and organize data.
Use a font, alignment, format, pattern, border, or capitalization style for
column labels that is different from the format you assign to the data in the
list. Format the cells as text before you type the column labels.

Use cell borders When you want to separate labels from data, use cell
borders €” not blank rows or dashed lines €” to insert lines below the labels.
How to apply borders to cells.

Avoid blank rows and columns Avoid putting blank rows and columns in the
list so that Excel can more easily detect and select the list.

Don't type leading or trailing spaces Extra spaces at the beginning or end
of a cell affect sorting and searching. Instead of typing spaces, indent the
text within the cell.

--
- K Dales


"Jim May" wrote:

It's returning a r/t 1004 - The extracted range has a missing or illegal
field name
message << maybe just under certaini conditions,, my current problem (when
I'm getting the error message occurs when --
My Seleted range includes 25 numbers formatted as test (sorted ascending with
duplicated numbers)

Can someone spot my problem?
TIA,

Sub DumpUnique()
Dim rng As Range
If Selection.Columns.Count 1 Then
MsgBox "You can only select One Column of Cells, Try again."
Exit Sub
End If
If Selection.Row = 1 Then
MsgBox "Your Selection cannot include Row 1, Try again."
Exit Sub
End If
TLocation = InputBox("To What Cell do I drop the Unique data")
Set rng = Selection.Offset(-1, 0) _
.Resize(Selection.Rows.Count + 1, 1)
rng(1).Value = "TempHeader"
rng.AdvancedFilter Action:=xlFilterCopy, _ ' Is bombing here !!!
CopyToRange:=Range(TLocation), Unique:=True
rng(1).Value = ""
Range(TLocation).CurrentRegion.Sort Key1:=Range(TLocation), _
Order1:=xlAscending, Header:=xlYes
Range(TLocation).Delete shift:=xlUp
End Sub

Reply
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
Changing a cell if its value is not as great as another Gupta A. Excel Discussion (Misc queries) 1 August 19th 06 09:46 PM
What Formula to use(VBA will be great to) Need help with sumif Excel Discussion (Misc queries) 2 May 17th 06 07:09 AM
Help on any part of this would be great Jimmycooker Excel Discussion (Misc queries) 0 February 7th 06 10:21 AM
THIS IS A GREAT SITE! THANK YOU!!!! Excel User Excel Discussion (Misc queries) 1 August 8th 05 06:38 PM
Great discovery? David Excel Worksheet Functions 0 May 12th 05 08:25 AM


All times are GMT +1. The time now is 12:35 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"