ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   named range (https://www.excelbanter.com/excel-programming/398804-named-range.html)

jhyatt

named range
 
I have code that sets a named range automaticlly now i am trying copy that
range to anither sheet in the workbook but everthing i have tried fails.

any help would be appriciated thank you in advance.

Don Guillett

named range
 
Tell us more

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"jhyatt" wrote in message
...
I have code that sets a named range automaticlly now i am trying copy that
range to anither sheet in the workbook but everthing i have tried fails.

any help would be appriciated thank you in advance.



JRForm

named range
 
jhyatt,

Try
Selection.Copy 'copy your range
Sheets("Sheet2").Select 'go to the sheet you want
Range("A16").Select 'the area to place it
ActiveSheet.Paste 'paste

"jhyatt" wrote:

I have code that sets a named range automaticlly now i am trying copy that
range to anither sheet in the workbook but everthing i have tried fails.

any help would be appriciated thank you in advance.


jhyatt

named range
 
this is the code i am using what i need to do is copy the range and paste to
another sheet. there may be an easier way to accomplish what i am trying to
do but this is the only way have found to find all records that contain
"promotion"

Public Sub AddNamepro(ByVal Promotion As String)
Dim wks As Worksheet
Dim rngToSearch As Range
Dim rngFound As Range
Dim rngFoundAll As Range
Dim strFirstAddress As String

Set wks = ActiveSheet
Set rngToSearch = wks.Columns("k")
Set rngFound = rngToSearch.find(What:=Promotion, _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False, _
SearchFormat:=False)
If Not rngFound Is Nothing Then
Set rngFoundAll = rngFound
strFirstAddress = rngFound.Address
Do
Set rngFoundAll = Union(rngFound, rngFoundAll)
Set rngFound = rngToSearch.FindNext(rngFound)
Loop Until rngFound.Address = strFirstAddress
ThisWorkbook.Names.Add Promotion, rngFoundAll.Address
End If

"JRForm" wrote:

jhyatt,

Try
Selection.Copy 'copy your range
Sheets("Sheet2").Select 'go to the sheet you want
Range("A16").Select 'the area to place it
ActiveSheet.Paste 'paste

"jhyatt" wrote:

I have code that sets a named range automaticlly now i am trying copy that
range to anither sheet in the workbook but everthing i have tried fails.

any help would be appriciated thank you in advance.


JRForm

named range
 
jhyatt,

I am a little confused about your question. You state your looking for any
occurance of the word "Promotion" but this code is naming a range "Promotion".

What do you want to have happen? If you want to look for the word
"promotion" then what do you want to do when it is found? Perhaps copy the
entire row of data or maybe selected cells and paste them in a sheet
named(??)?

"jhyatt" wrote:

this is the code i am using what i need to do is copy the range and paste to
another sheet. there may be an easier way to accomplish what i am trying to
do but this is the only way have found to find all records that contain
"promotion"

Public Sub AddNamepro(ByVal Promotion As String)
Dim wks As Worksheet
Dim rngToSearch As Range
Dim rngFound As Range
Dim rngFoundAll As Range
Dim strFirstAddress As String

Set wks = ActiveSheet
Set rngToSearch = wks.Columns("k")
Set rngFound = rngToSearch.find(What:=Promotion, _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False, _
SearchFormat:=False)
If Not rngFound Is Nothing Then
Set rngFoundAll = rngFound
strFirstAddress = rngFound.Address
Do
Set rngFoundAll = Union(rngFound, rngFoundAll)
Set rngFound = rngToSearch.FindNext(rngFound)
Loop Until rngFound.Address = strFirstAddress
ThisWorkbook.Names.Add Promotion, rngFoundAll.Address
End If

"JRForm" wrote:

jhyatt,

Try
Selection.Copy 'copy your range
Sheets("Sheet2").Select 'go to the sheet you want
Range("A16").Select 'the area to place it
ActiveSheet.Paste 'paste

"jhyatt" wrote:

I have code that sets a named range automaticlly now i am trying copy that
range to anither sheet in the workbook but everthing i have tried fails.

any help would be appriciated thank you in advance.


jhyatt

named range
 
I have a workbook that has a sheet for every day. on the sheets are the
people that have come into the office. some receive promotional prices i am
trying to find all entries so i can track the promotions. all entries are in
the same column. i want to find all and put them on a totals sheet in the
workbook.

JRForm

named range
 
jhyatt,

how many columns do you want for each person put into the summary sheet? If
the promotion is found what do we copy over for example,
column k = Promotion
column j=name
columni=time
columnh=date
columnl=price

I would only copy over the neccessary data.

"jhyatt" wrote:

I have a workbook that has a sheet for every day. on the sheets are the
people that have come into the office. some receive promotional prices i am
trying to find all entries so i can track the promotions. all entries are in
the same column. i want to find all and put them on a totals sheet in the
workbook.


jhyatt

named range
 
the way the sheets is set.

column a = name
column b = date
column c-e = billed
column f = rate
coulmn g = discount price
coulumn k = discount type

the only info i would like to bring over would be the name, date, discount
price


"JRForm" wrote:

jhyatt,

how many columns do you want for each person put into the summary sheet? If
the promotion is found what do we copy over for example,
column k = Promotion
column j=name
columni=time
columnh=date
columnl=price

I would only copy over the neccessary data.

"jhyatt" wrote:

I have a workbook that has a sheet for every day. on the sheets are the
people that have come into the office. some receive promotional prices i am
trying to find all entries so i can track the promotions. all entries are in
the same column. i want to find all and put them on a totals sheet in the
workbook.



All times are GMT +1. The time now is 02:53 AM.

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