LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 536
Default Naming non-contigent cells with vba

This code from help works fine to name cells B1 to B5 with the text in A1 to A5.
How do I modify it to name cells B1, F1 and K1 with the text in A1 and to name cells B2, F2 and K2 with the text in A2 and so on?

So with text in A1 = Data1 then cells B1,F1 and K1 are named Data1,
the text in A2 = Data2 then cells B2, F2 and K2 are named Data2.

This is for a possible solution to a poster who wants
to produce the sum of three non contingent cells from one sheet to another sheet. I suggested naming the range Data and on the other sheet =SUM(Data).
I then learn he has 200+ rows. Presents a tedious problem in naming.

Code to sum the non-contigent cell on sheet1 and zip the totals over to sheet2 is certanily a possibility. However, the poster did not know how to name a range so I am assuming a very new user who would be more comfortable with some simpler formulas once all the naming gets done.

Option Explicit

Sub NameIt()
Dim rangeToName As Range
Set rangeToName = Worksheets("Sheet1").Range("A1:B5")
rangeToName.CreateNames Left:=True
End Sub

'This example creates names for cells B1:B3 based on the text in cells A1:A3.
'Note that you must include the cells that contain the names in the range,
'even though the names are created only for cells B1:B3.

Thanks,
Regards,
Howard
 
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
Range naming cells with blank cells through coding Naveen J V Excel Discussion (Misc queries) 1 March 27th 08 01:46 PM
Naming Cells - need help Brad Excel Programming 1 December 18th 07 06:40 PM
naming cells Dave Excel Discussion (Misc queries) 2 September 6th 06 09:00 PM
Naming cells... Steve Excel Worksheet Functions 6 January 3rd 06 07:40 PM
Naming Cells tjtjjtjt[_2_] Excel Programming 2 February 7th 04 06:53 PM


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

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"