Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Re-Naming a column
I am populating these cells with data but I don't know how to Name the
columns that the new data is in. Thanks for any help. I am brand new at excel. CArol For intI = 0 To 4 wholeRange.End(xlToRight).Next = arrI(intI) ???? = Name(intI).Value Next |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Re-Naming a column
Hi Carol -
You might be able to name your columnar range AFTER you populate it by: Range("C10").CurrentRegion.Name = "CarolsRangeName" (where "C10" is a cell inside your populated range.) I'm not getting the exact picture of what you want to do. If the above suggestion doesn't do what you want it to do, please reply with a bit more detail. -- Jay "Carol G" wrote: I am populating these cells with data but I don't know how to Name the columns that the new data is in. Thanks for any help. I am brand new at excel. CArol For intI = 0 To 4 wholeRange.End(xlToRight).Next = arrI(intI) ???? = Name(intI).Value Next |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Re-Naming a column
I'm sorry I don't even know what the current region is yet.
I don't think this will work because I also don't know what the address of the cell is (only that it is to the right of my last cell. I just thought I'd go to the last column used, populate the one to the right and then assign a name to that column using a string array that holds the 5 names, loop through and do the same thing for 4 more columns after that. The problem is that I don't know the excel object very well so I don't know how to write out the left hand side of the assignment statement. Hopefully I'm making more sense. Thanks for your help Jay Here's my code so far. Carol Sub SortByPriceDifference() Dim wholeRange As Range Dim MyWorksheet As Worksheet Dim rw As Range Dim Difference As Integer 'Set MyWorksheet = Worksheets("LouieData").Activate Set wholeRange = ActiveSheet.UsedRange Dim intI As Integer Dim arrI(5) As Integer For Each rw In wholeRange.Rows Difference = rw.Columns("H") - rw.Columns("G") Select Case Difference Case Is < -15000 'More Than -15,000 arrI(0) = arrI(0) + 1 Case -15000 To -10000 'Between 10,000 and 15,000 Below arrI(1) = arrI(1) + 1 Case -9999 To -5000 'Between 5,000 and 10,000 Below arrI(2) = arrI(2) + 1 Case -4999 To 0 'Between 0 and 5000 Below arrI(3) = arrI(3) + 1 Case Else 'Sold OverPrice arrI(4) = arrI(4) + 1 End Select Next For intI = 0 To 4 wholeRange.End(xlToRight).Next = arrI(intI) ???? here is where I want to assign the name looping through an array of 5 names. Next End Sub "Jay" wrote in message ... Hi Carol - You might be able to name your columnar range AFTER you populate it by: Range("C10").CurrentRegion.Name = "CarolsRangeName" (where "C10" is a cell inside your populated range.) I'm not getting the exact picture of what you want to do. If the above suggestion doesn't do what you want it to do, please reply with a bit more detail. -- Jay "Carol G" wrote: I am populating these cells with data but I don't know how to Name the columns that the new data is in. Thanks for any help. I am brand new at excel. CArol For intI = 0 To 4 wholeRange.End(xlToRight).Next = arrI(intI) ???? = Name(intI).Value Next |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Re-Naming a column
Hi Carol -
I'm still a bit unclear about the exact cells that you want to name, but here's a stab at a starting point. It will apply a name to each of the 5 cells containing a tally. If you want each name to be applied to a larger group of cells (a whole or part of a column as you mentioned), we'll have to modify a bit. 1. Suggested starting point for the left side of the assignment statement: wholeRange.End(xlToRight).Name = 2. Right side issues: Your suggestion was 'Name(intI).Value'. First, the word "Name" is reserved in VBA for the Name property, so change it to something else (here I used 'rngName'). Second, the Name property (on the left side) requires that the actual name (on the right side) be passed with quotes. For example, wholeRange.End(xlToRight).Name = "< -15000" is correct when using a string constant ("<-15000"). So, when using a variable on the right side, the quotes must be included in the variable's value or you can concatenate them on as follows: wholeRange.End(xlToRight).Name = "" & rngName(intI) & "" -- Jay "Carol G" wrote: I'm sorry I don't even know what the current region is yet. I don't think this will work because I also don't know what the address of the cell is (only that it is to the right of my last cell. I just thought I'd go to the last column used, populate the one to the right and then assign a name to that column using a string array that holds the 5 names, loop through and do the same thing for 4 more columns after that. The problem is that I don't know the excel object very well so I don't know how to write out the left hand side of the assignment statement. Hopefully I'm making more sense. Thanks for your help Jay Here's my code so far. Carol Sub SortByPriceDifference() Dim wholeRange As Range Dim MyWorksheet As Worksheet Dim rw As Range Dim Difference As Integer 'Set MyWorksheet = Worksheets("LouieData").Activate Set wholeRange = ActiveSheet.UsedRange Dim intI As Integer Dim arrI(5) As Integer For Each rw In wholeRange.Rows Difference = rw.Columns("H") - rw.Columns("G") Select Case Difference Case Is < -15000 'More Than -15,000 arrI(0) = arrI(0) + 1 Case -15000 To -10000 'Between 10,000 and 15,000 Below arrI(1) = arrI(1) + 1 Case -9999 To -5000 'Between 5,000 and 10,000 Below arrI(2) = arrI(2) + 1 Case -4999 To 0 'Between 0 and 5000 Below arrI(3) = arrI(3) + 1 Case Else 'Sold OverPrice arrI(4) = arrI(4) + 1 End Select Next For intI = 0 To 4 wholeRange.End(xlToRight).Next = arrI(intI) ???? here is where I want to assign the name looping through an array of 5 names. Next End Sub "Jay" wrote in message ... Hi Carol - You might be able to name your columnar range AFTER you populate it by: Range("C10").CurrentRegion.Name = "CarolsRangeName" (where "C10" is a cell inside your populated range.) I'm not getting the exact picture of what you want to do. If the above suggestion doesn't do what you want it to do, please reply with a bit more detail. -- Jay "Carol G" wrote: I am populating these cells with data but I don't know how to Name the columns that the new data is in. Thanks for any help. I am brand new at excel. CArol For intI = 0 To 4 wholeRange.End(xlToRight).Next = arrI(intI) ???? = Name(intI).Value Next |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Re-Naming a column
Jay,
I had wished to apply the name to the whole columns that the tally's are in but maybe just the cells that I have the totals in. I thought I could work my way up from the cell I was in and name whole column. I am going to be pie charting the results but I only need them named so that I know which are which. I'll work with it today. Thanks for your help. Carol "Jay" wrote in message ... Hi Carol - I'm still a bit unclear about the exact cells that you want to name, but here's a stab at a starting point. It will apply a name to each of the 5 cells containing a tally. If you want each name to be applied to a larger group of cells (a whole or part of a column as you mentioned), we'll have to modify a bit. 1. Suggested starting point for the left side of the assignment statement: wholeRange.End(xlToRight).Name = 2. Right side issues: Your suggestion was 'Name(intI).Value'. First, the word "Name" is reserved in VBA for the Name property, so change it to something else (here I used 'rngName'). Second, the Name property (on the left side) requires that the actual name (on the right side) be passed with quotes. For example, wholeRange.End(xlToRight).Name = "< -15000" is correct when using a string constant ("<-15000"). So, when using a variable on the right side, the quotes must be included in the variable's value or you can concatenate them on as follows: wholeRange.End(xlToRight).Name = "" & rngName(intI) & "" -- Jay "Carol G" wrote: I'm sorry I don't even know what the current region is yet. I don't think this will work because I also don't know what the address of the cell is (only that it is to the right of my last cell. I just thought I'd go to the last column used, populate the one to the right and then assign a name to that column using a string array that holds the 5 names, loop through and do the same thing for 4 more columns after that. The problem is that I don't know the excel object very well so I don't know how to write out the left hand side of the assignment statement. Hopefully I'm making more sense. Thanks for your help Jay Here's my code so far. Carol Sub SortByPriceDifference() Dim wholeRange As Range Dim MyWorksheet As Worksheet Dim rw As Range Dim Difference As Integer 'Set MyWorksheet = Worksheets("LouieData").Activate Set wholeRange = ActiveSheet.UsedRange Dim intI As Integer Dim arrI(5) As Integer For Each rw In wholeRange.Rows Difference = rw.Columns("H") - rw.Columns("G") Select Case Difference Case Is < -15000 'More Than -15,000 arrI(0) = arrI(0) + 1 Case -15000 To -10000 'Between 10,000 and 15,000 Below arrI(1) = arrI(1) + 1 Case -9999 To -5000 'Between 5,000 and 10,000 Below arrI(2) = arrI(2) + 1 Case -4999 To 0 'Between 0 and 5000 Below arrI(3) = arrI(3) + 1 Case Else 'Sold OverPrice arrI(4) = arrI(4) + 1 End Select Next For intI = 0 To 4 wholeRange.End(xlToRight).Next = arrI(intI) ???? here is where I want to assign the name looping through an array of 5 names. Next End Sub "Jay" wrote in message ... Hi Carol - You might be able to name your columnar range AFTER you populate it by: Range("C10").CurrentRegion.Name = "CarolsRangeName" (where "C10" is a cell inside your populated range.) I'm not getting the exact picture of what you want to do. If the above suggestion doesn't do what you want it to do, please reply with a bit more detail. -- Jay "Carol G" wrote: I am populating these cells with data but I don't know how to Name the columns that the new data is in. Thanks for any help. I am brand new at excel. CArol For intI = 0 To 4 wholeRange.End(xlToRight).Next = arrI(intI) ???? = Name(intI).Value Next |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Re-Naming a column
This should name the entire column:
wholeRange.End(xlToRight).EntireColumn.Name = "" & rngName(intI) & "" I have to hit the road this morning, so I won't be checking this post for 4-6hrs. Will check this post later today (~1430 -1630 PST) to see if any problems arise. -- Jay "Carol G" wrote: Jay, I had wished to apply the name to the whole columns that the tally's are in but maybe just the cells that I have the totals in. I thought I could work my way up from the cell I was in and name whole column. I am going to be pie charting the results but I only need them named so that I know which are which. I'll work with it today. Thanks for your help. Carol "Jay" wrote in message ... Hi Carol - I'm still a bit unclear about the exact cells that you want to name, but here's a stab at a starting point. It will apply a name to each of the 5 cells containing a tally. If you want each name to be applied to a larger group of cells (a whole or part of a column as you mentioned), we'll have to modify a bit. 1. Suggested starting point for the left side of the assignment statement: wholeRange.End(xlToRight).Name = 2. Right side issues: Your suggestion was 'Name(intI).Value'. First, the word "Name" is reserved in VBA for the Name property, so change it to something else (here I used 'rngName'). Second, the Name property (on the left side) requires that the actual name (on the right side) be passed with quotes. For example, wholeRange.End(xlToRight).Name = "< -15000" is correct when using a string constant ("<-15000"). So, when using a variable on the right side, the quotes must be included in the variable's value or you can concatenate them on as follows: wholeRange.End(xlToRight).Name = "" & rngName(intI) & "" -- Jay "Carol G" wrote: I'm sorry I don't even know what the current region is yet. I don't think this will work because I also don't know what the address of the cell is (only that it is to the right of my last cell. I just thought I'd go to the last column used, populate the one to the right and then assign a name to that column using a string array that holds the 5 names, loop through and do the same thing for 4 more columns after that. The problem is that I don't know the excel object very well so I don't know how to write out the left hand side of the assignment statement. Hopefully I'm making more sense. Thanks for your help Jay Here's my code so far. Carol Sub SortByPriceDifference() Dim wholeRange As Range Dim MyWorksheet As Worksheet Dim rw As Range Dim Difference As Integer 'Set MyWorksheet = Worksheets("LouieData").Activate Set wholeRange = ActiveSheet.UsedRange Dim intI As Integer Dim arrI(5) As Integer For Each rw In wholeRange.Rows Difference = rw.Columns("H") - rw.Columns("G") Select Case Difference Case Is < -15000 'More Than -15,000 arrI(0) = arrI(0) + 1 Case -15000 To -10000 'Between 10,000 and 15,000 Below arrI(1) = arrI(1) + 1 Case -9999 To -5000 'Between 5,000 and 10,000 Below arrI(2) = arrI(2) + 1 Case -4999 To 0 'Between 0 and 5000 Below arrI(3) = arrI(3) + 1 Case Else 'Sold OverPrice arrI(4) = arrI(4) + 1 End Select Next For intI = 0 To 4 wholeRange.End(xlToRight).Next = arrI(intI) ???? here is where I want to assign the name looping through an array of 5 names. Next End Sub "Jay" wrote in message ... Hi Carol - You might be able to name your columnar range AFTER you populate it by: Range("C10").CurrentRegion.Name = "CarolsRangeName" (where "C10" is a cell inside your populated range.) I'm not getting the exact picture of what you want to do. If the above suggestion doesn't do what you want it to do, please reply with a bit more detail. -- Jay "Carol G" wrote: I am populating these cells with data but I don't know how to Name the columns that the new data is in. Thanks for any help. I am brand new at excel. CArol For intI = 0 To 4 wholeRange.End(xlToRight).Next = arrI(intI) ???? = Name(intI).Value Next |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Re-Naming a column
No that didn't work.
I think it may be to do with: .ApplyNames (which is a way to name range objects) but I'm having trouble so far. I will definitely get a manual in the next few days. Carol Thanks again for all the help. I don't want to put you out with your time though. I can use this without names if I have to: wholeRange.End(xlToRight).EntireColumn.ApplyNames Names:= "Jay" wrote in message ... This should name the entire column: wholeRange.End(xlToRight).EntireColumn.Name = "" & rngName(intI) & "" I have to hit the road this morning, so I won't be checking this post for 4-6hrs. Will check this post later today (~1430 -1630 PST) to see if any problems arise. -- Jay "Carol G" wrote: Jay, I had wished to apply the name to the whole columns that the tally's are in but maybe just the cells that I have the totals in. I thought I could work my way up from the cell I was in and name whole column. I am going to be pie charting the results but I only need them named so that I know which are which. I'll work with it today. Thanks for your help. Carol "Jay" wrote in message ... Hi Carol - I'm still a bit unclear about the exact cells that you want to name, but here's a stab at a starting point. It will apply a name to each of the 5 cells containing a tally. If you want each name to be applied to a larger group of cells (a whole or part of a column as you mentioned), we'll have to modify a bit. 1. Suggested starting point for the left side of the assignment statement: wholeRange.End(xlToRight).Name = 2. Right side issues: Your suggestion was 'Name(intI).Value'. First, the word "Name" is reserved in VBA for the Name property, so change it to something else (here I used 'rngName'). Second, the Name property (on the left side) requires that the actual name (on the right side) be passed with quotes. For example, wholeRange.End(xlToRight).Name = "< -15000" is correct when using a string constant ("<-15000"). So, when using a variable on the right side, the quotes must be included in the variable's value or you can concatenate them on as follows: wholeRange.End(xlToRight).Name = "" & rngName(intI) & "" -- Jay "Carol G" wrote: I'm sorry I don't even know what the current region is yet. I don't think this will work because I also don't know what the address of the cell is (only that it is to the right of my last cell. I just thought I'd go to the last column used, populate the one to the right and then assign a name to that column using a string array that holds the 5 names, loop through and do the same thing for 4 more columns after that. The problem is that I don't know the excel object very well so I don't know how to write out the left hand side of the assignment statement. Hopefully I'm making more sense. Thanks for your help Jay Here's my code so far. Carol Sub SortByPriceDifference() Dim wholeRange As Range Dim MyWorksheet As Worksheet Dim rw As Range Dim Difference As Integer 'Set MyWorksheet = Worksheets("LouieData").Activate Set wholeRange = ActiveSheet.UsedRange Dim intI As Integer Dim arrI(5) As Integer For Each rw In wholeRange.Rows Difference = rw.Columns("H") - rw.Columns("G") Select Case Difference Case Is < -15000 'More Than -15,000 arrI(0) = arrI(0) + 1 Case -15000 To -10000 'Between 10,000 and 15,000 Below arrI(1) = arrI(1) + 1 Case -9999 To -5000 'Between 5,000 and 10,000 Below arrI(2) = arrI(2) + 1 Case -4999 To 0 'Between 0 and 5000 Below arrI(3) = arrI(3) + 1 Case Else 'Sold OverPrice arrI(4) = arrI(4) + 1 End Select Next For intI = 0 To 4 wholeRange.End(xlToRight).Next = arrI(intI) ???? here is where I want to assign the name looping through an array of 5 names. Next End Sub "Jay" wrote in message ... Hi Carol - You might be able to name your columnar range AFTER you populate it by: Range("C10").CurrentRegion.Name = "CarolsRangeName" (where "C10" is a cell inside your populated range.) I'm not getting the exact picture of what you want to do. If the above suggestion doesn't do what you want it to do, please reply with a bit more detail. -- Jay "Carol G" wrote: I am populating these cells with data but I don't know how to Name the columns that the new data is in. Thanks for any help. I am brand new at excel. CArol For intI = 0 To 4 wholeRange.End(xlToRight).Next = arrI(intI) ???? = Name(intI).Value Next |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Re-Naming a column
Hmmm... didn't work. No problem with the time commitment. Once committed,
the goal is the solution, the work-around, or the absolute dead end ! I think we must be close to the solution because the code is running, but apparently not naming the columns you want to name. I guess I'm just not grasping your naming objective. If you'd like to proceed, feel free to email me with an excel attachment that contains a sample of your data table. Also, highlight the cells you want to be named (use a different color for each unique range name). My email address is: [jc.sresearch a t hotmail - com] I'll check this post and that address for the next few days; if I don't hear from you by 3/5/07, I'll assume that you're pursuing other avenues. Good luck, and I hope to hear from you so we can solve this issue, -- Jay "Carol G" wrote: No that didn't work. I think it may be to do with: .ApplyNames (which is a way to name range objects) but I'm having trouble so far. I will definitely get a manual in the next few days. Carol Thanks again for all the help. I don't want to put you out with your time though. I can use this without names if I have to: wholeRange.End(xlToRight).EntireColumn.ApplyNames Names:= "Jay" wrote in message ... This should name the entire column: wholeRange.End(xlToRight).EntireColumn.Name = "" & rngName(intI) & "" I have to hit the road this morning, so I won't be checking this post for 4-6hrs. Will check this post later today (~1430 -1630 PST) to see if any problems arise. -- Jay "Carol G" wrote: Jay, I had wished to apply the name to the whole columns that the tally's are in but maybe just the cells that I have the totals in. I thought I could work my way up from the cell I was in and name whole column. I am going to be pie charting the results but I only need them named so that I know which are which. I'll work with it today. Thanks for your help. Carol "Jay" wrote in message ... Hi Carol - I'm still a bit unclear about the exact cells that you want to name, but here's a stab at a starting point. It will apply a name to each of the 5 cells containing a tally. If you want each name to be applied to a larger group of cells (a whole or part of a column as you mentioned), we'll have to modify a bit. 1. Suggested starting point for the left side of the assignment statement: wholeRange.End(xlToRight).Name = 2. Right side issues: Your suggestion was 'Name(intI).Value'. First, the word "Name" is reserved in VBA for the Name property, so change it to something else (here I used 'rngName'). Second, the Name property (on the left side) requires that the actual name (on the right side) be passed with quotes. For example, wholeRange.End(xlToRight).Name = "< -15000" is correct when using a string constant ("<-15000"). So, when using a variable on the right side, the quotes must be included in the variable's value or you can concatenate them on as follows: wholeRange.End(xlToRight).Name = "" & rngName(intI) & "" -- Jay "Carol G" wrote: I'm sorry I don't even know what the current region is yet. I don't think this will work because I also don't know what the address of the cell is (only that it is to the right of my last cell. I just thought I'd go to the last column used, populate the one to the right and then assign a name to that column using a string array that holds the 5 names, loop through and do the same thing for 4 more columns after that. The problem is that I don't know the excel object very well so I don't know how to write out the left hand side of the assignment statement. Hopefully I'm making more sense. Thanks for your help Jay Here's my code so far. Carol Sub SortByPriceDifference() Dim wholeRange As Range Dim MyWorksheet As Worksheet Dim rw As Range Dim Difference As Integer 'Set MyWorksheet = Worksheets("LouieData").Activate Set wholeRange = ActiveSheet.UsedRange Dim intI As Integer Dim arrI(5) As Integer For Each rw In wholeRange.Rows Difference = rw.Columns("H") - rw.Columns("G") Select Case Difference Case Is < -15000 'More Than -15,000 arrI(0) = arrI(0) + 1 Case -15000 To -10000 'Between 10,000 and 15,000 Below arrI(1) = arrI(1) + 1 Case -9999 To -5000 'Between 5,000 and 10,000 Below arrI(2) = arrI(2) + 1 Case -4999 To 0 'Between 0 and 5000 Below arrI(3) = arrI(3) + 1 Case Else 'Sold OverPrice arrI(4) = arrI(4) + 1 End Select Next For intI = 0 To 4 wholeRange.End(xlToRight).Next = arrI(intI) ???? here is where I want to assign the name looping through an array of 5 names. Next End Sub "Jay" wrote in message ... Hi Carol - You might be able to name your columnar range AFTER you populate it by: Range("C10").CurrentRegion.Name = "CarolsRangeName" (where "C10" is a cell inside your populated range.) I'm not getting the exact picture of what you want to do. If the above suggestion doesn't do what you want it to do, please reply with a bit more detail. -- Jay "Carol G" wrote: I am populating these cells with data but I don't know how to Name the columns that the new data is in. Thanks for any help. I am brand new at excel. CArol For intI = 0 To 4 wholeRange.End(xlToRight).Next = arrI(intI) ???? = Name(intI).Value Next |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
naming a column | Excel Discussion (Misc queries) | |||
naming a column | Excel Discussion (Misc queries) | |||
naming a grouped column | Excel Worksheet Functions | |||
Naming Row/column in same cell? | Setting up and Configuration of Excel | |||
naming the column | Excel Programming |