Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Name multiple cells in a range in an ordered manner
I want to name a block of cells depending on their position in the
block. Bascially, the user will make a selection, name the "block" (entire selection), and the macro will assign names to the cells depedning on their position in the block, by row, then column. For example, the user selects a block of cells four rows by four columns, names the block "SalesCategory," the macro then assigns the first cell in the block the name SalesCategory11, the last cell SalesCategory44. Think I can do it using For, but not sure if I use counter variables (i,j) within the add.name procedure, or whether I need to use an array. Any suggestions? imitk |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Name multiple cells in a range in an ordered manner
Sub BuildSubNames()
Dim rng as Range, i as Long, j as Long Dim s as Long s = "SaleCategory" set rng = Range(s) for i = 1 to rng.rows.count for j = 1 to rng.columns.count rng(i,j).Name = s & i & j Next Next end sub -- Regards, Tom Ogilvy " wrote: I want to name a block of cells depending on their position in the block. Bascially, the user will make a selection, name the "block" (entire selection), and the macro will assign names to the cells depedning on their position in the block, by row, then column. For example, the user selects a block of cells four rows by four columns, names the block "SalesCategory," the macro then assigns the first cell in the block the name SalesCategory11, the last cell SalesCategory44. Think I can do it using For, but not sure if I use counter variables (i,j) within the add.name procedure, or whether I need to use an array. Any suggestions? imitk |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel Macro to Modify Multiple Worksheets in the Same Manner | Excel Discussion (Misc queries) | |||
How do I add up row sums in a systematic manner? | Excel Programming | |||
INTRICATE PROBLEM- How to find multiple text,excluding "H", in a multiple range of cells, then replacing 0 with another number in another cell | Excel Worksheet Functions | |||
shell to behave in synchronous manner | Excel Programming | |||
macro needed for sorting txt in a ceratian manner | Excel Programming |