Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Define name automatically

In selected range, for example a1:d234 I need to
give a1:d1 the name row1,a2:d2 the name row2 and so on..
Any suggestions?
Using excel 2000.
Arne


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Define name automatically


For i = 1 To 234
Range("A1").Resize(,4).Name = "row" & i
Next i

--

HTH

RP
(remove nothere from the email address if mailing direct)


"arne" wrote in message
...
In selected range, for example a1:d234 I need to
give a1:d1 the name row1,a2:d2 the name row2 and so on..
Any suggestions?
Using excel 2000.
Arne




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Define name automatically

Tried it. It gives different name for the same range
=Sheet1!$A$1:$D$1

In selected range, for example a1:d234 I need to
give a1:d1 the name row1,a2:d2 the name row2 and so on..
Any suggestions?
Using excel 2000.
Arne



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Define name automatically

I'm guessing you're testing your macro with something like:

Option Explicit
Sub testme()
Dim nm As Name
Dim i As Long

For i = 1 To 2 '234
Range("A1").Resize(, 4).Name = "row" & i
Next i

For Each nm In Names
MsgBox nm
'try this instead:
msgbox nm.name
Next nm

End Sub



arne wrote:

Tried it. It gives different name for the same range
=Sheet1!$A$1:$D$1

In selected range, for example a1:d234 I need to
give a1:d1 the name row1,a2:d2 the name row2 and so on..
Any suggestions?
Using excel 2000.
Arne


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Define name automatically

You are all clever and helpfull! I have one problem with your solutions: I
do not always have
234 rows. In one way or another i must count the number of rows in my
selection.
(the numbers of columns is fixed, but a genious solutions is to count the
numbers of columns in my selections)

Arne

"arne" skrev i melding
...
In selected range, for example a1:d234 I need to
give a1:d1 the name row1,a2:d2 the name row2 and so on..
Any suggestions?
Using excel 2000.
Arne





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Define name automatically

Can you find the last row in column A and use that?

Dim i As Long
Dim LastRow as long

lastrow = cells(rows.count,"A").end(xlup).row
For i = 1 To Lastrow
Cells(i, "A").Resize(, 4).Name = "row" & format(i,"000")
Next i



arne wrote:

You are all clever and helpfull! I have one problem with your solutions: I
do not always have
234 rows. In one way or another i must count the number of rows in my
selection.
(the numbers of columns is fixed, but a genious solutions is to count the
numbers of columns in my selections)

Arne

"arne" skrev i melding
...
In selected range, for example a1:d234 I need to
give a1:d1 the name row1,a2:d2 the name row2 and so on..
Any suggestions?
Using excel 2000.
Arne


--

Dave Peterson
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
Automatically define a list of words in Excel? Chris Excel Discussion (Misc queries) 4 July 6th 06 01:07 PM
Define name Q Benjamin Excel Discussion (Misc queries) 3 October 19th 05 01:29 PM
How do I define colors that are automatically applied to data seri 65538 Charts and Charting in Excel 1 June 8th 05 05:42 AM
define name sunshine Excel Discussion (Misc queries) 1 March 29th 05 01:37 AM
Automatically define series of named ranges Jon Tillman Excel Programming 7 June 18th 04 07:39 AM


All times are GMT +1. The time now is 08:13 PM.

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

About Us

"It's about Microsoft Excel"