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: 293
Default Copy A Named Range To a Different Sheet

Greetings,

I have 2 sheets: "Input" and "Budget".

The source list is a named range called "NameSource" (D3:D839) which
is the list that the new names are being added.

Special problem: the names are not in any particular order and they
are added into the various days of the month. they are not in order,
there are many duplicates and there are a lot of blanks in the middle
of this range called "NameSource"

I need to access this list of customer names, but I need the list
alphabetized and blanks removed.

I tried to do this by coping the range("NameSource") into a helper
sheet called "Customer", into a named range called "NameDest". Then
in a sheet level sub (Worksheet_Change event sub) in the sheet called
"Input", I called up a public sub from a general module.

Here is the sheet sub from sheet "Input":

Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
GetSourceNameList
On Error GoTo 0
End Sub

Here is the general module sub:

Public Sub GetSourceNameList()
With Application
.EnableEvents = False
.ScreenUpdating = False
.Calculation = xlManual
End With
Range("NameSource").Select
Selection.Copy
Sheets("Customers").Select
Range("A3").Select
Selection.PasteSpecial _
Paste:=xlPasteValues, _
Operation:=xlNone, _
SkipBlanks:=False, _
Transpose:=False
Application.CutCopyMode = False
Range("A1:A839").AdvancedFilter _
Action:=xlFilterInPlace, _
Unique:=True
ActiveCell.SpecialCells(xlLastCell).Select
Range("NameDest").Select
Selection.Sort _
Key1:=Range("A3"), _
Order1:=xlAscending, _
Header:=xlno, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Sheets("Input").Select
Range("C3").Select
With Application
.EnableEvents = True
.ScreenUpdating = True
.Calculation = xlAutomatic
End With

End Sub

This is what the macro recorded gave. It almost works!!!!

There are a couple of "challenges" left yet. :^}

1st problem: the named range has no blank rows showing. There are a
few hundred blank rows, but the blank rows all have a height = 0 (the
default height is 20) and as such I only SEE the rows with data in
them. This looks ok on the surface, but in the "Budget" sheet where
the cells in column A are linked to the "Customer" sheet, each
customer name needs to be in alphabetical order with no blanks. The
way that this macro is working, this list of customer names has the
name in each row and the remainder of the 27 rows in each day are
blank. The 2nd day also has 27 rows reserved for it. First are the
entries for that day and the rest is left blank. And so on until after
the 31st day, then it stops.

Also, this code runs real slow!!!

I did make a macro to make all of the row heights, in the list, equal
to 20. This works, but it take a couple of HOURS to resize these 839
rows!!!

Anyone have any ideas as to where to look to fix this problem?

Any help is greatly appreciated.

-Minitman




 
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
Excel 2002 SP3 Copy Worksheet with another sheet named range now # Brewmanz Excel Discussion (Misc queries) 0 October 1st 09 12:35 AM
Copy Named Range from one sheet to another with formatting Sam via OfficeKB.com Excel Programming 17 March 5th 08 11:37 PM
Copy Several named Range in many sheets to a summary sheet Frank Situmorang Excel Programming 8 May 10th 07 09:14 AM
Finding a named range based on cell value and copy/paste to same sheet? Simon Lloyd[_715_] Excel Programming 1 May 11th 06 11:25 PM
copy named range gav meredith Excel Programming 4 April 28th 04 07:41 AM


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