ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Defining Regions with Names (https://www.excelbanter.com/excel-discussion-misc-queries/146207-defining-regions-names.html)

Elise148

Defining Regions with Names
 
I have been trying to define certain regions with a name (using the Insert,
Name, Define option of Excel). My problem is that when I run the macro that
uses the names, it wants to re-set the area that are named. I need to sort
the data in the named regions...does that make sense? Anyone know how to make
the names more consistant and not re-set?

Thanks. - Elise -

CLR

Defining Regions with Names
 
Post some of your code..........perhaps someone can help.

Vaya con Dios,
Chuck, CABGx3


"Elise148" wrote:

I have been trying to define certain regions with a name (using the Insert,
Name, Define option of Excel). My problem is that when I run the macro that
uses the names, it wants to re-set the area that are named. I need to sort
the data in the named regions...does that make sense? Anyone know how to make
the names more consistant and not re-set?

Thanks. - Elise -


Elise148

Defining Regions with Names
 
This is what's in my code so far...It finds a territory number, copies it and
pastes it to a cell that is found with an Input Box in the the region named
"PTI"..."PTI" is the named region that keeps changing

Range("A7").Select
Cells.Find(What:=InputBox("Enter Territory number you wish to search
for.", "Enter Territory Number."), After:=ActiveCell, LookIn:=xlValues,
LookAt:= _
xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext,
MatchCase:= _
False).Activate

ActiveCell.EntireRow.Select
Selection.Cut

Cells.Find(What:=InputBox("Enter a territory number of a distributor in
the PTI grouping.")).Select
Selection.Insert Shift:=xlDown
Selection.Sort Key1:=Range("PTI"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom

Range("A7").Select
End Sub

"CLR" wrote:

Post some of your code..........perhaps someone can help.

Vaya con Dios,
Chuck, CABGx3


"Elise148" wrote:

I have been trying to define certain regions with a name (using the Insert,
Name, Define option of Excel). My problem is that when I run the macro that
uses the names, it wants to re-set the area that are named. I need to sort
the data in the named regions...does that make sense? Anyone know how to make
the names more consistant and not re-set?

Thanks. - Elise -


CLR

Defining Regions with Names
 

Maybe try re-naming the PTI range each time AFTER the copy and paste
activity.....

something like,
ActiveWorkbook.Names.Add Name:="PTI", RefersToR1C1:="=Sheet1!R1C1"

hth
Vaya con Dios,
Chuck, CABGx3




"Elise148" wrote:

This is what's in my code so far...It finds a territory number, copies it and
pastes it to a cell that is found with an Input Box in the the region named
"PTI"..."PTI" is the named region that keeps changing

Range("A7").Select
Cells.Find(What:=InputBox("Enter Territory number you wish to search
for.", "Enter Territory Number."), After:=ActiveCell, LookIn:=xlValues,
LookAt:= _
xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext,
MatchCase:= _
False).Activate

ActiveCell.EntireRow.Select
Selection.Cut

Cells.Find(What:=InputBox("Enter a territory number of a distributor in
the PTI grouping.")).Select
Selection.Insert Shift:=xlDown
Selection.Sort Key1:=Range("PTI"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom

Range("A7").Select
End Sub

"CLR" wrote:

Post some of your code..........perhaps someone can help.

Vaya con Dios,
Chuck, CABGx3


"Elise148" wrote:

I have been trying to define certain regions with a name (using the Insert,
Name, Define option of Excel). My problem is that when I run the macro that
uses the names, it wants to re-set the area that are named. I need to sort
the data in the named regions...does that make sense? Anyone know how to make
the names more consistant and not re-set?

Thanks. - Elise -



All times are GMT +1. The time now is 04:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com