Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help with Do Loop that names rows as ranges

Hi,

I am working on some code that will look at each row (starting at ro
2) and define the row by the value that is on the row in column 1
until the program gets to a cell that is blank, in which the loo
stops. Everything seems to be working except for one small part.
keep on getting Run-time error 1004: That Name is not valid.

The following is my code:

Private Sub cmdCatAddSyn_Click()
'Synchronize all pages with the new category
'IN PROGRESS

RCount = 2
Do Until Worksheets(1).Cells(RCount, 1).Value = ""
Worksheets(1).Rows(RCount).Name = Worksheets(1).Cells(RCount, 1)
RCount = RCount + 1
Loop
End Sub

The section of code that is always highlighted i
Worksheets(1).Rows(RCount).Name=Worksheets(1).Cell s(RCount,1)

All help is appreciated, and thank you in advance

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Help with Do Loop that names rows as ranges

names can't have spaces and must being with a letter. The name also can't
be ambiguous in terms of being a cell reference (you can't create a name
like A10 for example, or R1 or C5).

If it is mostly working, I suspect the value in the cell is not a legal
name.

--
Regards,
Tom Ogilvy

"fifthhorseman " wrote in
message ...
Hi,

I am working on some code that will look at each row (starting at row
2) and define the row by the value that is on the row in column 1,
until the program gets to a cell that is blank, in which the loop
stops. Everything seems to be working except for one small part. I
keep on getting Run-time error 1004: That Name is not valid.

The following is my code:

Private Sub cmdCatAddSyn_Click()
'Synchronize all pages with the new category
'IN PROGRESS

RCount = 2
Do Until Worksheets(1).Cells(RCount, 1).Value = ""
Worksheets(1).Rows(RCount).Name = Worksheets(1).Cells(RCount, 1)
RCount = RCount + 1
Loop
End Sub

The section of code that is always highlighted is
Worksheets(1).Rows(RCount).Name=Worksheets(1).Cell s(RCount,1)

All help is appreciated, and thank you in advance.


---
Message posted from http://www.ExcelForum.com/



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
loop through all named ranges Bert[_3_] Excel Programming 4 June 19th 04 03:54 PM
Loop through ranges hotherps[_30_] Excel Programming 3 February 29th 04 08:35 AM
Loop through ranges columns hotherps[_32_] Excel Programming 1 February 26th 04 10:52 PM
How to loop through all ranges in a worksheet Nanette[_2_] Excel Programming 6 January 12th 04 07:30 PM
loop to name ranges spence[_3_] Excel Programming 1 January 8th 04 05:16 PM


All times are GMT +1. The time now is 12:33 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"