Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default 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
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 Macro to Modify Multiple Worksheets in the Same Manner [email protected] Excel Discussion (Misc queries) 1 February 16th 08 12:34 AM
How do I add up row sums in a systematic manner? wicked_rich Excel Programming 1 August 15th 05 03:54 PM
INTRICATE PROBLEM- How to find multiple text,excluding "H", in a multiple range of cells, then replacing 0 with another number in another cell Tourcat Excel Worksheet Functions 1 February 8th 05 06:26 PM
shell to behave in synchronous manner rraajjiibb Excel Programming 1 May 28th 04 08:52 PM
macro needed for sorting txt in a ceratian manner Martyn Excel Programming 1 January 24th 04 02:13 PM


All times are GMT +1. The time now is 12:20 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"